Datareader with Datagrid

jholiday

New member
Joined
Sep 23, 2004
Messages
1
Programming Experience
1-3
Hi there, :D
My problem How can i Use a datareader along with a Datagrid control to show data? I am using the grid in order to perfor a List of Values Functionality so the use of Dataset is a complete waste. I saw that there is an easy way to assosiate a datareader with a datagrid in ASP.NET:

Me.GrdLOV.DataSource = cmd.ExecuteReader
Me.GrdLOV.DataBind()

But the above lines wont work for VB .NET.... any suggestions from the community (that's why i like VB;) )?
 
This is one difference between the ASP.NET datagrid and the WinForms dataGrid. The ASP.NET datagrid is a control used to output a structured html table. It can use a dataReader as the dataSource, then when you call DataBind, the "reading" actually occurs. A WinForm dataGrid needs a dataSource that implements the IList or IListSource interface (array, collection, dataSet, dataTable ...) and doesn't require a call to DataBind (that method doesn't exist in Winforms).

If you are going to use a dataGrid in WinForms, you have to use a dataSource that implements the IList or IListSource interface.
 
Back
Top