32位win7 vb连接Mysql问题,大虾请指教下,在线等待
我用的win7 32位,数据源设置好了,Test成功;MySQL ODBC 5.1 Driver也装好啦;
运行下面代码报错:
“vb实时错误“3709“连接无法用于执行此操作,在此上下文中他可能已经被关闭或无效”
错误在这里rs.Open "Select * From 9_test_boe_idvg_raw"
Sub Command2_Click()
Set cn = New ADODB.Connection
cn.ConnectionString = "DRIVER={MySQL ODBC 5.1 Driver}; SERVER=10.80.72.216; DATABASE=yaf;UID=root;PWD=root; OPTION=3"
cn.Open
Set rs = New ADODB.Recordset
rs.Open "Select * From 9_test_boe_idvg_raw"
MsgBox rs.RecordCount
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
End Sub
[解决办法]
rs.Open "Select * From 9_test_boe_idvg_raw", cn