Dim rst As new adodb.Recordset
Dim strCnn As String
strCnn = "Provider=sqloledb;Data Source=(local);Initial Catalog=nycim;User Id=sa;Password=;"
Set rst= New adodb.Recordset
rst.CursorType = adOpenKeyset
rst.LockType = adLockOptimistic
rst.Open "select * from table1 " ,strCnn, , , adCmdText
set datagrid.datasource =rst上例用的是ADO访问本地的sqlserver数据库!dim dbs as database
dim rst as recordset
set dbs = opendatabase(app.path+"\a.mdb")
set rst = dbs.openrecordset("select * from table1")
set datagrid.datasource= rst
上例用的是DAO访问本地的ACCESS数据库!