Looping through a ResultSet with ADO.NET
Hi,
Simply trying to get a ResultSet and loop through it in ADO.NET. This is what I've got and it ain't working.
Code:
Dim dr As System.Data.OleDb.OleDbDataReader()
Dim comm As New OleDb.OleDbCommand()
comm.CommandText = "Select * from data2"
comm.CommandType = CommandType.Text
dr = comm.ExecuteReader(CommandBehavior.CloseConnection)
Dim s As String
s = ""
While dr.read()
MessageBox.Show(dr("id2").ToString())
End While
dr.close()
I get an error with ExecuteReader saying:
Value of type System.Data.OleDb.OleDbDataReader cannot be converted to a 1-dimensional array of type System.Data.OleDb.OleDbDataReader.
Any idea what this problem is????
Thanks!!:wave: