Trying to create a Data dll usnin C# in VS2019. Does C# support ADO.Net ?
Does C# support ADO.Net to access Data ?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Trying to create a Data dll usnin C# in VS2019. Does C# support ADO.Net ?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Vishal JoshiRank #377 · 6.7K reputationPosted Oct 24, 2023, 4:10 PM EDT
Hello Edward,
C# is the language. you can create console, desktop, web application etc with the help of c# language.
to use ADO.NET you need to use below system namespaces.
using System.Data; using System.Configuration; using System.Data.SqlClient; private void GetData() { string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString; string query = "SELECT * FROM Customers"; using (SqlConnection con = new SqlConnection(constr)) { using (SqlDataAdapter sda = new SqlDataAdapter(query, con)) { using (DataTable dt = new DataTable()) { sda.Fill(dt); // use DataAdapter to bind data to grid or you can utilize as per requirement. } } } }Thanks
Edward Aymami29 reputationPosted Oct 24, 2023, 8:24 PM EDT
Does this work for VS2019? also thank you for the quick response.
Vishal JoshiRank #377 · 6.7K reputationPosted Oct 25, 2023, 1:40 AM EDT
Hello Edward,
Yes. it will work for VS2019.