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
How can we add/remove row's in "datatable" object of "dataset"?
What is meant by executenonquery?
What is data relation in ado.net?
What does sqldatareader return?
How can I retrieve two tables of data at a time by using data reader? Data reader read and forward only, how is it possible to get 2 tables of data at a time?
What do you mean by ‘batch updates’?
What is ado.net connection?
Why do we serialize data?
Which database is the ado.net sql connection object designed for?
What are the drawbacks of using ado.net?
What do you know about ado.net's objects?
What is serialization and de-serialization in .net? How can we serialize the dataset object?
What is full form of ado?
What does ado stand for?
What is the difference between dataset and datatable?