I have the following code that is meant to get data from an online server:
Dim da As MySqlDataAdapter = New MySqlDataAdapter
Dim dtOnline As DataTable = New DataTable
Dim sql As String = "SELECT ID, Description FROM stocklocations WHERE CoID = @CoID AND ShopID = @ShopID"
Using con As MySqlConnection = New MySqlConnection(gen.connStringOnline)
Using cmd As MySqlCommand = New MySqlCommand(sql, con)
cmd.Parameters.AddWithValue("@CoID", gen.CoID)
cmd.Parameters.AddWithValue("@ShopID", gen.shopID)
cmd.CommandTimeout = 86400
da.SelectCommand = cmd
con.Open()
da.Fill(dtOnline)
con.Dispose()
End Using
End Using
The line da.Fill(dtOnline)
returns an error: Fatal error encountered attempting to read the resultset
- To check if it was a connection problem, I put the
con.Open()
line, and it connects. - Based on the similar posts here, I extended the command’s timeout using
cmd.CommandTimeout = 86400
. - I have been able to establish connection with mysql Workbench and I am able to read, insert etc from there.
But on the code above, I still get the error onda.Fill(dtOnline)
I’m using mysql server 5.6.
Any ideas what else I can try?