请教各位大师一个查询问题!在线等待中。。。。。。 查日期型要注意以下几点:日期的格式建议使用format;最好用between来查找一定的范围,因为你查"2002.11.19",其实你查的是"2002.11.19 00:00:00"。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 查询ACCESS数据库应使用: data between #2002-10-01# and #2002-10-25#查询SQL数据库应使用: data between '2002-10-01' and '2002-10-25' 我的源代码是这样的: For i = 0 To 14 If Combo7(i).Text <> "" And Text3(i).Text <> "" Then str = str + " " + Label18(i).Caption str = str + " " + Combo7(i).Text str = str + " " + "( '*" & Trim(Text3(i).Text) & "*')" str = str + " " + Combo6(i).Text End If If RS.EOF Then MsgBox ("无所需查找的资料") Exit Sub End If Next str = Replace(str, "=", "LIKE") str = Replace(str, "并且", "and") str = Replace(str, "或者", "or") RS.Filter = str Label7.Caption = RS.RecordCount如果在Text3中输入日期型变量,就不行了!如何既能够用SQL来查字符型变量,又能够查日期型变量?这可能吗?请教! 如何既能够用SQL来查字符型变量,又能够查日期型变量?这可能吗?请教!不可能,你把下面的代码:str = str + " " + "( '*" & Trim(Text3(i).Text) & "*')"改成:str = str + " " + "( '#" & format(Text3(i).Text,"m/d/yy") & "#')"试试. 求教:VB+MSSQLServer2000存储过程超时问题,多谢!! 输出度分秒 为什么我在工程声明下面这个API时提示:用户定义类型未定义 [我不晦气谁晦气----100分]来着有分 请问如何做作移动工具条? VB获取Oracle记录集问题 VB绘制Excel时网格线异常的情况 mscomm发送缓冲区问题 VB的data report里怎么打印一张图片 文件夹,怎样在程序中将其共享!? 帮帮忙!哪里有ActiveReports2.0版本或提供可用下载,高分! 一道难题(给好的方案者包给100分)
data between #2002-10-01# and #2002-10-25#
查询SQL数据库应使用:
data between '2002-10-01' and '2002-10-25'
For i = 0 To 14
If Combo7(i).Text <> "" And Text3(i).Text <> "" Then
str = str + " " + Label18(i).Caption
str = str + " " + Combo7(i).Text
str = str + " " + "( '*" & Trim(Text3(i).Text) & "*')"
str = str + " " + Combo6(i).Text
End If
If RS.EOF Then
MsgBox ("无所需查找的资料")
Exit Sub
End If
Next
str = Replace(str, "=", "LIKE")
str = Replace(str, "并且", "and")
str = Replace(str, "或者", "or")
RS.Filter = str
Label7.Caption = RS.RecordCount
如果在Text3中输入日期型变量,就不行了!如何既能够用SQL来查字符型变量,又能够查日期型变量?这可能吗?请教!
不可能,你把下面的代码:
str = str + " " + "( '*" & Trim(Text3(i).Text) & "*')"
改成:
str = str + " " + "( '#" & format(Text3(i).Text,"m/d/yy") & "#')"
试试.