VB 至少一个参数没有被制定值 求助高手!!!! 用全部积分感谢

来源:百度知道 编辑:UC知道 时间:2024/05/04 06:04:44
Private Sub cmdsearch_Click()
Dim sqlstr As String
Dim wherestr As String
Dim i As Integer
sqlstr = "SELECT 时间,第一级子活动名称,第二级子活动名称,第三级子活动名称,前期之文件名,过程之文件名,总结之文件名,前期之文件路径,过程之文件路径,总结之文件路径 FROM studenttable "
wherestr = ""
If optnKeyFore.Value Or optnKeyBack.Value Then
If txtYearKeyFore.Text = "" Or txtMonthKeyFore.Text= ""Or txtDateKeyFore.Text = "" Then
MsgBox "请完整填写查询时!",vbOKOnly+vbInformation, "查询"
Exit Sub
End If
If wherestr <> "" Then
If optnTimeand.Value Then wherestr = wherestr + " and "
Else wherestr = wherestr + " or "
End If End If
If optnKeyFore.Value Then
wherestr = wherestr + "publishtime <'" & txtYearKeyFore.Text + "-" + txtMonthKeyFore.Text + "-" + txtDateKeyFore.Text & "'"
Else wherestr = wherestr

一般是sql语句的问题。
解决此问题的方法就是认真的对照SQL语句和数据库表是否对应……

sql 语句里面有字段名称错误 或者
如果你用的数据库是access,则日期字符串两边是用#而不是单引号

无法回答,DataE_Student类的代码我们都不知道。
建议:跟踪DataE_Student类中cmdFindStudent方法的语句执行情况,看看SQL语句中的什么参数没有被制定~

sql语句有问题了