I have been trying to sort this out but I must be missing something and was wondering if someone can take a quick look.
I have tested my SQL statement and I created and tested it in SQLyog so I removed it to keep the post short. In fact, I moved it back to SQLyog to test. My connection is declared at the module level and is open.
The code errors at the datatable load statement with "Object reference not set to an instance of an object."
The reader is returning nothing which is causing the error, but I can't figure out why it is returning nothing. It should return over 180 rows.
Can anyone point me in the right direction to figure this out?
TIA, rasinc
VB.Net Code:
Dim datTab As DataTable = Nothing Dim strSQLText As String = "" Dim reader As MySqlDataReader = Nothing Dim strSQLCmd As New MySqlCommand strSQLText = "My SQL Statement" strSQLCmd.CommandText = strSQLText strSQLCmd.Connection = myConnection reader = strSQLCmd.ExecuteReader datTab.Load(reader)
I have tested my SQL statement and I created and tested it in SQLyog so I removed it to keep the post short. In fact, I moved it back to SQLyog to test. My connection is declared at the module level and is open.
The code errors at the datatable load statement with "Object reference not set to an instance of an object."
The reader is returning nothing which is causing the error, but I can't figure out why it is returning nothing. It should return over 180 rows.
Can anyone point me in the right direction to figure this out?
TIA, rasinc