Write Code for DataSet,Datareader,and by deleting the button
gridview should be empty?
Answer / Ritesh Kumar Siddharth
Here's a simple example of using DataSet and DataReader with ADO.NET in C#:nnFirst, create a function to fill a DataSet:n```csharpnpublic static DataSet FillDataSet(string connectionString, string query)n{n SqlConnection connection = new SqlConnection(connectionString);n SqlCommand command = new SqlCommand(query, connection);n DataSet dataSet = new DataSet();n SqlDataAdapter adapter = new SqlDataAdapter(command);n adapter.Fill(dataSet);n return dataSet;n}n```nNext, create a function to fill a DataReader:n```csharpnpublic static void FillDataReader(string connectionString, string query, Action<SqlDataReader> action)n{n SqlConnection connection = new SqlConnection(connectionString);n SqlCommand command = new SqlCommand(query, connection);n connection.Open();n SqlDataReader reader = command.ExecuteReader();n action(reader);n reader.Close();n}n```nFinally, to empty a GridView after deleting a row, simply bind an empty DataTable to the GridView's DataSource property:n```csharpngridView1.DataSource = null;ngridView1.DataSource = new DataTable();ngridView1.DataBind();n```
| Is This Answer Correct ? | 0 Yes | 0 No |
Explain what are the deferred execution and the immediate execution in linq?
What is the difference between imperative and interrogative code?
Do you know what is linq?
Please explain when should you use .net web forms over asp.net mvc?
What’s different between process and application in .net?
How to send the Mail in C# using ASP.Net ? And my Answer is as follows ?
Explain what are an object and a class?
What is .net debug & trace?
Tell us what is heap and what is stack?
How is development of a Windows service different from a Windows Forms application?
What are two different types of remote object creation mode in .net?
what is the default value of CHAR type?in C# using asp.net?