用Mysql数据库,MyODBC,VB程序用ADO连
程序应该没问题, 以前一直用的没有变过,但最近1周,平均每运行20多小时就会报错:Run-time error '-2147467259(80004005)':
[MySQL][ODBC 3.51 Driver][mysqld-4.0.15-nt]Server shutdown in progress看了mysql的log, 没有记录这些异常的shutdown请问大家怎么解决? 我怀疑可能中了病毒, 大家知道怎么查吗?

解决方案 »

  1.   

    按照  duyhui(杜) 的思路检查了一下:定时器有段程序:
        Set Results2 = New ADODB.Recordset
        Results2.CursorLocation = adUseServer
    但没有用Results2, 也没有调用Results2.Close。问题可能出在这里吧?总的程序结构如下:开始结束时,开关连接
    Private Sub Form_Load()
        Dim ODBCName As String
        ODBCName = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;UID=root;PWD=;DATABASE=test;OPTION=0"
        Set MySQLConnection = New ADODB.Connection
        MySQLConnection.ConnectionString = ODBCName
        MySQLConnection.Open
    End SubPrivate Sub Form_Unload(Cancel As Integer)
        MySQLConnection.Close
    End Sub程序里会调用多个func,诸如此类:Sub Func1()
        Dim Results As ADODB.Recordset
        Dim SQLQuery As String
        Set Results1 = New ADODB.Recordset
        Results1.CursorLocation = adUseServer
        
        SQLQuery = "select * from t1 where id=" & Str(x)
        Results1.Open SQLQuery, MySQLConnection
        If Results1.EOF Then
            SQLQuery = "insert into online values(" & Str(x) & "," & )"
            MySQLConnection.Execute SQLQuery
        Else
            SQLQuery = "update online set online=" & Str(x) & ", " where id=" & Str(x)
            MySQLConnection.Execute SQLQuery
        End If    Results1.Close
    End Sub大家看没问题吧?