adspace


How to get records from a database?

Answer Posted / Saurabh Kumar

To retrieve records from a database in C#.NET, you can use ADO.NET classes like SqlCommand, SqlDataReader, or DataTable. Here's an example using SqlCommand and SqlDataReader: SqlConnection connection = new SqlConnection(connectionString); SqlCommand command = new SqlCommand("SELECT * FROM table", connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { // process each record here }

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

No New Questions to Answer in this Category !!    You can

Post New Questions

Answer Questions in Different Category