VB 用SQL语句查询时变量的引用问题!
Private Sub Command1_Click()a = SX.Text
If GJZ.Text = "" Then
b = "*"
Else
b = GJZ.Text
End If
= adCmdText
Adodc1.RecordSource = "select * from employee where " & a & " = '" & b & "'"
Adodc1.Refresh
DataGrid1.Refresh
Set DataGrid1.DataSource = Adodc1
End Sub
上面的查询语句中变量a和b的引用对吗?为什么我在查询时,什么都查不到?请高手解答!