Can Datareader be used instead of Data Adapter to populate the Datagrid
In Windows Forms application using vb.net / access - can datareader be used to populate the datagrid? The datagrid in my form is just for display purposes. Modifications to the data will be handled by double clicking the grid which would take to another form which handles insert /update / delete.
I tried to populate the datagrid with a datareader:
Dim sql As String = "SELECT * FROM Pcardlog where RDM='R'"
Cmd.Connection = Conn
Cmd.CommandText = sql
Conn.Open()
DataGrid1.DataSource = Cmd.ExecuteReader
I get the following error:
An unhandled exception of type 'System.Exception' occurred in system.windows.forms.dll
Additional information: Complex DataBinding accepts as a data source either an IList or an IListSource
Could someone throw some light on how to get this to work?
dip_2004_05142 reputationPosted Dec 10, 2003, 5:28 AM EST
spgilmoreRank #1,616 · 964 reputationPosted Dec 19, 2003, 8:30 AM EST
crend_king24 reputationPosted Feb 9, 2004, 5:49 AM EST
Carlos SanchezRank #6,113 · 276 reputationPosted Jul 7, 2004, 12:25 PM EDT
p.jones132 reputationPosted Jul 8, 2004, 6:02 AM EDT
Adam ErstelleRank #3,005 · 479 reputationPosted Jul 10, 2004, 8:35 PM EDT
Carlos SanchezRank #6,113 · 276 reputationPosted Jul 13, 2004, 7:41 AM EDT
nagenderk2 reputationPosted Aug 5, 2004, 10:21 PM EDT
Carlos SanchezRank #6,113 · 276 reputationPosted Aug 9, 2004, 7:41 AM EDT
rlehnherr2 reputationPosted Sep 1, 2004, 11:18 AM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts