Database in C#
i was following a tutorial that was using database MySql and happens that they were using SqlConnection = new SqlConnection(connectionString); from the library System.Data.SqlClient; but idk if its that im usin net9 but to my project pop up something about that class is obsolete... so they say that i should use Microsoft.Data.SqlClient and i installed. Someone know the how or why isnt available, i mean i can used it if i use an older version? Also i have the question that what its the standar to use database connection its with LINQ? or it with the Microsoft.Data.SqlClient, or something that i read about entity framework core and use it like a class,modelview,context database, sorry i am stumbling with all of these. Thanks for helping in advance. pd:was a WPF project.
9 Replies
those libraries are for SQL Server, not MySQL
Microsoft.Data.SqlClient is the one you should be using assuming you're using SQL Server
if you want to write queries with LINQ then yes you need to look at EF Core or alternatives like Linq2DB
sorry my bad, i have sql server installed
i found the main error, i was creating a .net application instead a net framewokr app... LMAO
you should not be using .NET Framework for new projects
why ? Im new in .Net, im just following the tutorials.
it's an older version than the ones that are just called .NET
oh okey
but there are some functionalities that i dont have in net , like setting the datasource, the reference in the solution explorer...
:Hmm:
i can tell you that you can definitely access databases in modern .NET
yeah i know. i will know how to do the same with .net. for now i just following the tutorials.
You need Microsoft.Data not System.Data
System.Data is deprecated
or something