求助:VB至少一个参数没有被指定值!
查询出库单程序,界面如图所示,我想要的是选择查询。查询命令按钮就是Command6,在文本框输入要查询的字段时,点击按钮,就会在DataGrid控件显示相应内容,数据库已连接好,就是在第一个选中“出库单号”查询运行的时候,出现:至少一个参数没有被指定值!请问我编的程序有问题吗?哪个地方有问题啊?
请高手指点!不胜感激!作业,很快就要交了
程序代码:
Private Sub Command6_Click() Dim rs_findreader As New ADODB.Recordset Dim sql As String If Check1.Value = vbChecked Then sql = "出库单号=" & Trim(Text1.Text & " ") & " " End If If Check2.Value = vbChecked Then If Trim(sql) = "" Then sql = "商品代码='" & Trim(Text1.Text & " ") & "'" Else sql = sql & "and 商品代码='" & Trim(Text1.Text & " ") & "'" End If End If If Check3.Value = vbChecked Then If Trim(sql) = "" Then sql = "商品名称='" & Trim(Combo2.Text & " ") & "'" Else sql = sql & "and 商品名称='" & Trim(Combo2.Text & " ") & "'" End If End If sql = "select * from 出库信息 where " & sql rs_findreader.CursorLocation = adUseClient rs_findreader.Open sql, conn, adOpenKeyset, adLockPessimistic DataGrid1.AllowAddNew = False DataGrid1.AllowDelete = False DataGrid1.AllowUpdate = False If rs_findreader.RecordCount = 0 Then MsgBox "查询不到采购管理信息!", vbOKOnly + vbExclamation Else Set DataGrid1.DataSource = rs_findreader End If End Sub