[求助]难题啊,急
查询功能实现后 ,我想把查询到的值 显示在对话框里,怎么办?希望大虾们帮我看看 ,最好帮我写个简单的例子,谢谢!
Public Function ConnectString() As String
ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + _
App.Path + "\product.mdb;persist security Info=False"
End Function
以上是我在模块中第一的全局函数
下面的是我在窗体中写的查找代码,但在 Adodc1.ConnectionString = ConnectString这句时发生了错误,这是为什么呢?
大家们再把我看看,谢谢!
Dim strSQL As String
If Trim(txtName.Text) = "" Then
MsgBox "查询姓名不能为空!", vbOKOnly + vbExclamation, "警告!"
txtName.SetFocus
Exit Sub
End If
strSQL = "select *from product where 名称 like " _
+ "" + Replace(Trim(txtName.Text), "", "", 1) + "%"
Adodc1.ConnectionString = ConnectString
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = strSQL
Adodc1.Refresh
End Sub