cBarry263
Active member
I have a program in which I want to poll a database via an ODBC connection. I have set up the connection, and the query. THe problem is, I can't figure out how to see the results of my query. Basically, the table in the database has a bunch of rows, each containing a field called "Site_ID". I want to have all these site_ID's returned so that I can loop through them and do some processing. Any help would be greatly appreciated. Here's what I have that is not working:
Dim centralObjDataAdapter As New OdbcDataAdapter
Dim centralDataSet As DataSet = New DataSet
centralObjDataAdapter.SelectCommand.Connection = ODBCconn
centralObjDataAdapter.SelectCommand.CommandText = selectString
centralObjDataAdapter.Fill(centralDataSet, "Central Results")
.
.
NTFNsiteIDs = centralDataSet.Tables("Central Results").Rows(0).Item(0)
I would expect this to return the first site_ID from the table but I am getting an "Object reference not set to an instance of an object" error. I'm not sure how this error applies here.
Also, I'm having a lot of trouble with accessing data and such via ODBC, anyone know of any good websites that explain this?
Dim centralObjDataAdapter As New OdbcDataAdapter
Dim centralDataSet As DataSet = New DataSet
centralObjDataAdapter.SelectCommand.Connection = ODBCconn
centralObjDataAdapter.SelectCommand.CommandText = selectString
centralObjDataAdapter.Fill(centralDataSet, "Central Results")
.
.
NTFNsiteIDs = centralDataSet.Tables("Central Results").Rows(0).Item(0)
I would expect this to return the first site_ID from the table but I am getting an "Object reference not set to an instance of an object" error. I'm not sure how this error applies here.
Also, I'm having a lot of trouble with accessing data and such via ODBC, anyone know of any good websites that explain this?