|
可以连接本地mysql,查询全部数据库可以查询出来,但因为数据量巨大,想要根据sheet1第一列值查询,如何编辑,万分感谢
错误代码为:rs.Open "select * from`daily_hco_full_info` where 机构id ='"[A1]"'"
Sub db()
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.ConnectionString = "Driver={MySQL ODBC 8.0 Unicode Driver};Server=192.168.0.198;DB=saas;UID=root;PWD=12345;OPTION=3;"
conn.Open
rs.Open "select * from`daily_hco_full_info` where 机构id ='"[A1]"'", conn
[B2].CopyFromRecordset rs
rs.Close: Set rs = Nothing
conn.Close: Set conn = Nothing
MsgBox "处理完毕", vbOKOnly, "提示信息"
End Sub
|
|