Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim connstrf3 As String
If rs.State = adStateOpen Then rs.Close
If con.State = adStateOpen Then con.Close
connstrf3 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\数据库名.mdb;Persist Security Info=False"
con.ConnectionString = connstrf3
con.Open
con.CursorLocation = adUseClient
rs.Open "SELECT * FROM 老师 WHERE 教师编号='" & Text9.Text & "'", con, , adLockOptimistic
Set DataGrid1.DataSource = rs