Lost connection to MySQL server during query

Lost connection to MySQL server during query

Postby vbturbo » Tue 29 May 2007 07:47

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?
vbturbo
 
Posts: 3
Joined: Wed 12 Jul 2006 12:21

Postby Alexey » Tue 29 May 2007 15:56

Try to increase da.SelectCommand.CommandTimeout property.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby vbturbo » Wed 30 May 2007 09:05

what is the default (time in sec.)for this property ?

Jens
vbturbo
 
Posts: 3
Joined: Wed 12 Jul 2006 12:21

Postby Alexey » Wed 30 May 2007 10:05

The default value is 30 seconds.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43


Return to dotConnect for MySQL