必须安装MYSQL的驱动
才行,不管是VB还是c++都需要这个驱动。代码如下: Public Function exemysql(ByVal sql As String) As ADODB.Recordset sql = Trim$(sql) Set conn = New ADODB.Connection Set rs = New ADODB.Recordset conn.Open "Driver=MySQL ODBC 3.51 Driver" &_ "Server=服务器地址" &_ "Port=3306" &_ "Database=
数据库名" &_ "Uid=用户名" &_ "Pwd=密码" conn.DefaultDatabase = "数据库名" conn.CursorLocation = adUseClient Set rs.ActiveConnection = conn rs.LockType = adLockBatchOptimistic rs.CursorType = adOpenKeyset rs.Open sql Set exesql = rs Set rs = Nothing Set conn = Nothing End Function提示,连接
字符串为:
Provider=Microsoft.ACE.OLEDB.12.0Data Source=C:\myFolder\myAccessFile.accdbJet OLEDB:Database Password=MyDbPassword
评论列表(0条)