Sub Button1_OnLButtonUp(nFlag, x, y)
set conn=CreateObject("ADODB.Connection")
set rst=CreateObject("ADODB.Recordset")
dim connectstring
connectString = "DRIVER={SQL Server};Server=127.0.0.1,1433;Database=String;Uid=sa;Pwd=123456;"
conn.open connectString
if conn.State = 1 then
selectSql = "select * from String.String"
rst.Open selectSql, conn,1,1
if rst.EOF and rst.BOF then
app.MsgBox "No Data","错误提示框",0
else
Dim objFSO, objFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("D:\String\String.xlsx", True)
do while not rst.EOF
Name=rst("NAME").value
VALUE=rst("VALUE").value
app.MsgBox "NAME: " & NAME &", VALUE: " & VALUE, "查询结果",0
objFile.Write "NAME: " & NAME &", VALUE: " & VALUE & vbCrLf
rst.MoveNext
loop
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
end if
rst.Close
set rst=nothing
conn.Close
set conn=nothing
else
app.MsgBox "open mysqldb failed!","错误提示框",0
end if
End Sub
错误行rst.Open selectSql, conn,1,1 错误类型:Microsoft OLE DB Provider for ODBC Drivers :ODBC驱动程序不支持所需的属性。各位大佬求解决办法。