datagrid控件用法
Private Sub Form_Load()
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Set cnn = New ADODB.Connection
Set rst = New ADODB.Recordset
Dim sql As String
cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\vb\db1.mdb;Persist Security Info=False"
cnn.Open
sql = "select user,pwd from yh order by user"
rst.Open sql, cnn, adOpenKeyset, adLockOptimistic
rst.MoveFirst
Set DataGrid1.DataSource = rst
End Sub
cnn.CursorLocation = adUseClient