主题:按text输入查询显示到datagrid出错求解!
请问我这段代码
这里Set rs = GetRs("select * from publish where " & sql)
显示编译错误:
子程序或函数未定义如何修改??
Private Sub cmdQuery_Click()
Dim sql As String
sql = Text1.Text
If Text1.Text <> "" Then
sql = "name like '%" & Text1.Text & "%'"
End If
getData ("select * from publish where " & sql)
End Sub
Private Sub getData(sql As String)
Set rs = GetRs("select * from publish where " & sql)
Set DataGrid1.DataSource = rs
DataGrid1.Columns(0).Width = 1400
DataGrid1.Columns(2).Width = 1000
DataGrid1.Columns(3).Width = 1200
DataGrid1.Columns(4).Width = 1200
DataGrid1.Columns(5).Width = 4000
End Sub
这里Set rs = GetRs("select * from publish where " & sql)
显示编译错误:
子程序或函数未定义如何修改??
Private Sub cmdQuery_Click()
Dim sql As String
sql = Text1.Text
If Text1.Text <> "" Then
sql = "name like '%" & Text1.Text & "%'"
End If
getData ("select * from publish where " & sql)
End Sub
Private Sub getData(sql As String)
Set rs = GetRs("select * from publish where " & sql)
Set DataGrid1.DataSource = rs
DataGrid1.Columns(0).Width = 1400
DataGrid1.Columns(2).Width = 1000
DataGrid1.Columns(3).Width = 1200
DataGrid1.Columns(4).Width = 1200
DataGrid1.Columns(5).Width = 4000
End Sub