Page 1 of 1

Lost connection to MySQL server during query

Posted: Tue 29 May 2007 07:47
by vbturbo
Hi

I have tried to set the connectiontimeout to 20 sec. but doesn't seem to work.

im using a straight forward select command

Private _con As MySqlConnection

Public Function getDataTable(ByRef strSQL As String) As DataTable
Dim strcon As String = ""
strcon = ConfigurationManager.AppSettings("ConnectionString")
_con = New MySqlConnection(strcon)


Dim da As New MySqlDataAdapter(strSQL, _con)

Dim objDataTable As New DataTable()

_con.Open()

Try
da.Fill(objDataTable)
Catch
_con.ConnectionTimeout = 20
da.Fill(objDataTable)
End Try
_con.Close()
_con.Dispose()

Return objDataTable
End Function


in my database table there are 15- 20 rows and 6 columns!

what can i do?

Posted: Tue 29 May 2007 15:56
by Alexey
Try to increase da.SelectCommand.CommandTimeout property.

Posted: Wed 30 May 2007 09:05
by vbturbo
what is the default (time in sec.)for this property ?

Jens

Posted: Wed 30 May 2007 10:05
by Alexey
The default value is 30 seconds.