如何使用 Mac Excel 2011 net.VB 从 MySQL 服务器读取数据和发送数据?
提前致谢 !
设置 ODBC 连接
Private Sub btnTestReadInMysqlData_Click()
Dim objDB, arrRecord, strRecord, strOutput
Dim oRS, nRec, oFld
Dim row
'Database connection & select all from Table
Set objDB = DBConnect()
Set oRS = objDB.Execute("SELECT * FROM members")
'Dump Records from Table
nRec = 0
row = 1
Do While Not oRS.EOF
For Each oFld In oRS.Fields
'WScript.Echo oFld.Name & " = " & oFld.Value
Worksheets("Tabelle1").Cells(row, 1).Value = oFld.Value
'increment
row = row + 1
Next
oRS.MoveNext
Loop
End Sub
Function DBConnect()
Set objDB = CreateObject("ADODB.Connection")
objDB.Open "websitedata"
Set DBConnect = objDB
End Function