ODBC驱动程序不支持请求的属性

时间:2015-12-19 13:32:52

标签: mysql excel vba odbc

我正在使用VBA宏从excel查询mysql但是我遇到了非ascii值的问题。这是我的代码:

Sub sqldene()
    Set conn = New ADODB.Connection
    conn.Open "DRIVER={MySQL ODBC 5.3 Unicode Driver}" _
    & ";SERVER=localhost" _
    & ";DATABASE=main" _
    & ";UID=root" _
    & ";PWD="

    Set rs1 = New ADODB.Recordset

    With Worksheets("Sayfa1").Cells(1, 1)
        sqlstr = "SELECT * FROM `ana` WHERE ADI=" & Chr(34) & .Value & Chr(34) & ";"
    End With
    MsgBox (sqlstr)
    rs1.Open sqlstr, conn, adOpenStatic

    With Worksheets("Sayfa1").Cells(3, 1)
        .ClearContents
        .CopyFromRecordset rs1
    End With
    rs1.Close
    Set rs1 = Nothing
End Sub

如果我将YASAR放在Cell 1,1中,它会起作用,但如果我在YAŞAR处放置rs1.Open sqlstr, conn, adOpenStatic而不是代码中断,并显示错误消息,指出ODBC驱动程序不支持请求的属性。

是否有针对此错误的修复程序。

0 个答案:

没有答案