Dim ConnX As ADODB.Connection
Private Sub cmdConn_Click()
'生成连接字符串
'If txtPassword.Text = "" Then
'数据库没有密码
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & _
App.Path & _
"/data.mdb;" & _
" Persist Security Info=False"
'text1.Text = App.Path + "/data.mdb;"
'Else
'End If
On Error GoTo ConnErr
'连接数据库
Adodc1.CommandType = adCmdText ' " & text1.Text & "%
Adodc1.RecordSource = "select * from kehu where tel like '" & text1.Text & "%' "
Adodc1.Refresh
'MsgBox "连接数据库成功!", vbInformation, "连接"
Exit Sub
ConnErr:
MsgBox "连接数据库错误!", vbInformation, "连接"
End Sub