任何关于使用vb.net(windows窗体)自动重新连接丢失连接到mysql服务器的想法。
我打算开发一个应用程序。具体来说,它是网吧的计时器。
如果服务器下载了一些更新并需要重新启动,则客户端PC将在服务器启动时自动重新连接。任何的想法?感谢
我正在使用此代码进行连接:
Dim DatabaseName As String = "xxx"
Dim server As String = "xxx"
Dim userName As String = "xxx"
Dim password As String = "xxx"
If Not conn Is Nothing Then conn.Close()
conn.ConnectionString = String.Format("server={0}; user id={1}; password={2}; database={3}; pooling=false", server, userName, password, DatabaseName)
Try
conn.Open()
MsgBox("Connected")
Catch ex As Exception
MsgBox(ex.Message)
End Try
conn.Close()