做一VB的工具,打开窗体的时候就已经把ADO中的表INFO的数据显示在DataGrid里,条件查询后把结果显示在DataGrid中,按照书上步骤写的,但是总提示FROM语句错误,ADO的refresh出错,高手指点下丫
Private Sub btnSearchCategory_Click()
Dim strSql As String
'cn.Provider = "microsoft.jet.oledb.4.0"
'cn.ConnectionString = itemFilePath.Text
If cn.State <> adStateClosed Then cn.Close
cn.Open strSql = "select * from INFO where num = " & "'" & cmbEquipCategory.Text & "'"
Adodc1.RecordSource = strSql
Adodc1.Refresh
End If
cn.Close
End Sub
Private Sub btnSearchCategory_Click()
Dim strSql As String
'cn.Provider = "microsoft.jet.oledb.4.0"
'cn.ConnectionString = itemFilePath.Text
If cn.State <> adStateClosed Then cn.Close
cn.Open strSql = "select * from INFO where num = " & "'" & cmbEquipCategory.Text & "'"
Adodc1.RecordSource = strSql
Adodc1.Refresh
End If
cn.Close
End Sub
Set DataGrid1.DataSource = Adodc1
Dim strSql As String
strSql = "select * from INFO where num = " & "'" & cmbEquipCategory.Text & "'"
Adodc1.RecordSource = strSql
Adodc1.Refresh