|
我想在本地access里面的vba,通过odbc连接远程的access数据库,连接语句该怎么写?网上搜了半天都是sqlserver和oracle的。很着急,希望大家能够帮忙。
我这里有个连接sqlserver的例子,可惜不会改。
Dim conn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim sql As String
Set conn = New ADODB.Connection
conn.Open "Provider=MSDASQL;DRIVER=SQL Server; SERVER=10.81.70.212;DATABASE=MS_work; UID=ms; PWD=123"
sql = "select date,ID,out from dbo.m200712_CENTER where ID='12' and date='2007-12-10'"
Set rst = New ADODB.Recordset
rst.CursorLocation = adUseClient
rst.Open sql, conn |
|