在 工程->引用 中选上Microsoft ActiveX Data Object 2.8 Library
在 工程->部件 中选上Microsoft DataGrid Control 6.0(SP6)(OLEDB)显示数据控件
声明
Private Rs As New ADODB.Recordset
Private Conn As New ADODB.Connection
使用
Dim str As String
str = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=C:/look.mdb "
Conn.CursorLocation = adUseClient
Conn.Open str
Rs.Open "select * from student",Conn,adOpenDynamic,adLockReadOnly
Set DataGrid1.DataSource = Rs'显示