When writing programs with VB, you often need to make the DataGrid control to display the contents of the database, which is generally binding DataGrid and ADO controls, which is more troublesome. Then I want to write code to achieve this function, the code is as follows: Public Function GetMDBRecordset (SQL As String, DatabasePath As String, Optional DatabasePassword As String) As Recordset On Error GoTo ErrorStats Dim wadoConnection As New Connection Dim wadoRecordset As New Recordset Dim PasswordString As String If Len (DatabasePassword) <> 0 Then PasswordString = "; Persist Security Info = False; Jet OLEDB: Database Password =" & DatabasePassword End If wadoConnection.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source =" & DatabasePath & PasswordString With wadoRecordset .ActiveConnection = wadoConnection .Source = SQL .CursorType = adOpenKeyset .LockType = adLockOptimistic .Open End With Set GetMDBRecordset = wadoRecordset Exit FunctionErrorStats: MsgBox "error number is:" & Err.Number & vbCrLf & "error details: "& Err.DescriptionEND FUNCTION Add the following code in a Button's Click event: set DataGrid1.datasource = getMdbRecordset (" Select * from table1 "," f: /db1.mdb ") This does open the database, but DataGrid is dead Not Now, after testing, certification database is indeed opened, just not shown in the DataGrid control. Later, I accidentally found a function written by my colleague, and set a CURSORLOCATION = ADUSECLIENT to the RecordSet object, so that it can be displayed in the DataGrid, it is quite strange. The code segment is as follows: with wadorecordset .activeconnection = wadoconnection .source = SQL .cursortype = adopenkeyset .lockType = adoptimistic .cursorLocation = aduseclient .Openend with = aduseclient .Openend with huh, this is fine.