Sub hh()
Dim sql As String
Dim rs As New ADODB.Recordset
Dim con As ADODB.Connection
Dim dbConnStr As String
dbConnStr = "Driver={MySQL ODBC 5.2 ANSI DRIVER}; SERVER=localhost; DATABASE=landscape; USER=root; PASSWORD=mypass;"
Set con = New ADODB.Connection
con.Open dbConnStr
sql = "SELECT '東京都' AS tokyou"
rs.Open sql, con
Debug.Print rs!tokyou
rs.Close
Set rs = Nothing
con.Close
Set con = Nothing
End Sub
返回像 “东·”
我已经试过:
1.使用adodb.stream到查询字符串转换为utf8,或以其他方式将查询结果转换为unicode
2.执行“set names = unicode;”在查询中
3.添加“charset = unicode;”在连接字符串时打开数据库连接
但它们都不起作用,请你帮助我,谢谢!VBA ADODB查询Mysql的返回字符腐败
如果使用'MySQL ODBC UNICODE Driver'而不是'ANSI',会出现什么情况。在你的情况下, – cha 2014-09-11 01:04:53
似乎是合理的,不知道最后一个字是什么意思。欢迎您使用 – cha 2014-09-11 01:24:33
“arigatou”=“谢谢”日文:) – johnn 2014-09-11 01:26:17