如:"select * from dd where rq =#" & rqdata & "#"
rqdata="2003-12-12" 或者"03-12-12"
在WIN2000中可到结果,但在WIN98中一样的语句,在数据库里查询不到结果,请问怎么解决?请详细说明!
rqdata="2003-12-12" 或者"03-12-12"
在WIN2000中可到结果,但在WIN98中一样的语句,在数据库里查询不到结果,请问怎么解决?请详细说明!
调试欢乐多
select * from dd where rq =#" & format(rqdata,"yyyy-MM-dd") & "#" (如果是sqlserver数据库,那么须将#换成')
你试试
不用条件
查询
输出日期字段值(可用断点调试,跟踪变量值)看格式,究竟是哪几个字符,什排列格式
yyyy-mm-dd
yy-mm-dd
mm-dd-yyyy
mm-dd-yy对我原来 就是这样解决的
select * from dd where rq ='" & format(rqdata,"yyyy-MM-dd") & "'"
If Text4.Text = "" Or Text5.Text = "" Or Len(Text4.Text) < 4 Then
MsgBox "请您完整填写查询时间!", vbOKOnly + vbInformation, "查询"
Exit Sub
End If
wherestr = wherestr + "出生日期 < '" & Text4.Text & "-" & Text5.Text & "-" & 1 & "'"
End If
If Option4.Value Then
If Text4.Text = "" Or Text5.Text = "" Or Len(Text4.Text) < 4 Then
MsgBox "请您完整填写查询时间!", vbOKOnly + vbInformation, "查询"
Exit Sub
Else
wherestr = wherestr + "出生日期 >'" & Trim$(Text4.Text) & "-" & Trim$(Text5.Text) & "-" & 31 & "'"
End If
End If
If Option5.Value Then
If Text4.Text = " " Or Text5.Text = " " Or Text8.Text = "" Or Text9.Text = "" Or Len(Text4.Text) < 4 Or Len(Text8.Text) < 4 Then
MsgBox "请您完整填写查询时间!", vbOKOnly + vbInformation, "查询"
Exit Sub
Else
wherestr = wherestr + "出生日期 Between '" & Text4.Text & "-" & Text5.Text & "-" & 1 & "' And '" & Text8.Text & "-" & Text9.Text & "-" & 1 & "'"
End If
End If