Can a DataReader be used as a DataSource for a GridView.
If it is so how will you handle paging.
Answer Posted / karthikeyant
some changes made in the above code
cmd.Connection = CON; //_cmd is sqlCommand and
CON is Connection
_cmd.CommandText = "select
Book_Code,ISBN,Title_Of_book from Book_Master";
SqlDataReader dr = _cmd.ExecuteReader();
DataTable dataTable = new DataTable();
dataTable.Load(dr);
dr.Close();
_cmd.Dispose();
dataGridView2.DataSource = dataTable;
| Is This Answer Correct ? | 7 Yes | 0 No |
Post New Answer View All Answers
Explain advantages of ado.net?
What are the parameters that control most of connection pooling behaviors?
What are the different namespaces used in the project to connect the database? What data providers available in .net to connect to database?
What is disconnected scenario in entity framework?
What is fill method in ado.net?
What are the different methods by which we can populate a dataset?
Which one of the following objects is a high-level abstraction of the connection and command objects in ado.net?
What are the major difference between classic ADO and ADO.NET?
Define the data provider classes that is supported by ado.net?
Can we create Synonymns in MS Acess,My Sql Server,Sql Server? But iam we can create in oracle!
Define connection string?
How would you connect to database using .NET?
What is Dataset Object?
What is an orm, and why would you use one instead of plain old ado.net?
What does ado stand for?