☆数据库查询问题☆
想实现数据库的查询功能,零件功能数据库,有两栏,零件名称和零件功能。窗体上有控件Adodc1、DataGrid1显示数据库内容,这步已经实现,下边还有两个label控件(按功能查询和按零件查询),两个text控件,让用户输入查询的内容,两个command控件(查询),让用户点查询后,能在上边的DataGrid1里显示查询的结果,请问程序代码或者控件的属性该如何实现。。谢谢了。。~~~~!!!!!!!!!
[解决办法]
Private Sub Command1_Click()
Set DataGrid1.DataSource = Nothing
Adodc1.RecordSource = "select * from 零件表 "
Adodc1.Recordset.Filter = "功能 like '% " + Text1 + "% ' "
Set DataGrid1.DataSource = Adodc1
DataGrid1.Refresh
End Sub
Private Sub Command2_Click()
Set DataGrid1.DataSource = Nothing
Adodc1.RecordSource = "select * from 零件表 "
Adodc1.Recordset.Filter = "名称= ' " + Text2 + " ' "
Set DataGrid1.DataSource = Adodc1
DataGrid1.Refresh
End Sub