IO操作超时MySQL vb.NET 2012

时间:2014-02-17 14:18:35

标签: mysql vb.net

就在上个星期五,这段代码完美运行,我能够在MySQL数据库中创建一个表,但现在它显示错误“IO操作超时”,需要解决方案的人谢谢。

Private Sub toCreateTable()

    Dim varString As String = "tablenaming"

    Dim Query As String
    Dim con As MySqlConnection = New MySqlConnection("server=192.168.0.1; user=logging;  database=db_logging; port=3306; password=passing;")
    con.Open()

    Query = "CREATE TABLE  `" & varString & "` ( usernames varchar(50) ) "

    Dim cmd As New MySqlCommand(Query, con)

    If (cmd.ExecuteNonQuery()) Then

    End If
    con.Close()

End Sub

1 个答案:

答案 0 :(得分:0)

尝试捕捉....把它放在你的If Then End If。

的位置
Try
    cmd.ExecuteNonQuery()
    'any other code that needs to be completed after running query

Catch ex As Exception
    MsgBox(ex.Message)

Finally
    con.Close()

End Try

然后告诉我们您是否收到任何异常消息