我在网上找了一下相关的帖子,还是不得其解,请各位指点:
Private Sub Form_Load()
Dim conStr As String
Set conn = New ADODB.Connection
Set rst = New ADODB.Recordset
conStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\data.mdb;Persist Security Info=False"
conn.Open conStr
With rst
.CursorLocation = adUseClient
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
End With
rst.Open "stuInfo", conn, , , adCmdTable
Set DBG1.DataSource = rst
End Sub
Private Sub Comname_Click()
Dim strsele As String
If txtName.Text = " " Then
MsgBox "姓名不能为空!", vbOKOnly, "提示信息"
txtName.SetFocus
End If
strsele = "select * from stuInfo Where name='" & trim(txtName.Text) & " '"
Set rst = conn.Execute(strsele)
End Sub
运行到Set rst = conn.Execute(strsele)报424错。
能否帮我加上相关代码