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
Command objects uses, purposes and their methods.
What are all components of ADO.Net data provider?
What is different between sqlcommand object and command behavior object?
What does executequery return?
What are ado.net objects?
What two types of data providers does ADO.NET supply? What determines which one you should use?
What are the pre-requisites for connection pooling?
What is the procedure to call a Stored Procedure of Back End in ADO (ActiveX Data Object) and RDO (Remote Data Objects)?
What is a string variable?
How to load multiple tables into a dataset?
What is oledb driver?
How will you differentiate between ADO (ActiveX Data Object) and RDO (Remote Data Objects)?
Is datareader faster than datatable?
Name which operations can you not perform on an ado.net dataset?
Some important instruction regarding ADO.NET connection string ?