Private Sub Command3_Click()
'--如何用Adodc控件代码去连接Access
Dim strConn As String
strConn = "Provider=MSDASQL.1;Persist Security Info=False;Extended Properties="DBQ=C:\Program Files\Common Files\ODBC\Data Sources\IP.mdb;DefaultDir=C:\Program Files\Common Files\ODBC\Data Sources;Driver={Driver do Microsoft Access (*.mdb)};DriverId=25;FIL=MS Access;FILEDSN=C:\Program Files\Common Files\ODBC\Data Sources\MYCEESS.dsn;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;""
' adodc的连接字符串
Adodc1.ConnectionString = strConn
' 指定Command对象的形态
Adodc1.CommandType = adCmdText
' 设置传回一个资料录集。
Adodc1.RecordSource = "Select * from ip"
' 将记录集合绑定DataGrid1
Set DataGrid1.DataSource = Adodc1
End Sub
[此贴子已经被作者于2007-5-23 21:23:45编辑过]