vb 关于日期字段的模糊查询 '各位:帮我看一下这段代码 Adodc1.RecordSource ="select * from tb_JSQK where in_date like '%" & txt_Month.Text & "%'" Adodc1.Refresh 'in_date字段是datetime格式,我用的DTPicker控件对其赋值,格式为2008-7-31 '但是我查询的时候在txt_Month里面写入查询的年份和月份,然后就应该显示当月的记录,可这样写好像行不'通啊!各位能帮帮我吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Adodc1.RecordSource ="select * from tb_JSQK where in_date like '%" & txt_Month.Text & "%'"我只知道对于日期型的在SQL语句中 一般是用 # 但是也可以将他改为字符型'不知我这样改行不行.'另类改法Adodc1.RecordSource ="select * from tb_JSQK where " & format(cstr(in_date),"yyyy/mm/dd" & " like '%" & format(txt_Month.Text,"yyyy/mm") & "%'"'以上是我一时即性改的.不知有没有语法错误. 我觉得你说得很有道理,但是我一时想不起来用什么空间好,DTPicker行吗?但是我不太会设置 Adodc1.RecordSource ="select * from tb_JSQK where in_date like #" & txt_Month.Text & " # " access:"select * from tb_JSQK where format(in_date,'yyyy-mm')= '" & format(txt_Month.Text,"yyyy-mm") & "'" SQL server:"select * from tb_JSQK where convert(vrachar(7),in_date,120)= '" & format(txt_Month.Text,"yyyy-mm") & "'" Dim Primitives As Collection 求教各位,谢谢!!! 为什么 Recordset.recordcount 总是为0 200分求学生体质健康上报文件内容和格式。 求S = 1 - 1/3 + 1/5 - 1/7 + 1/9-.......的有限循环时的值. Button添加图标,菜单添加图标 查找带通配符的文件,有什么好办法嘛 各位朋友,我知道你们只关心技术,其实我也一样 你们遇到过这样的问题吗? VB 中使用TAPI vb真的无法开发标准 dll吗?只能开发activeX dll? VB SQL 日期字段查询 VB转C# 的语句问题
Adodc1.RecordSource ="select * from tb_JSQK where in_date like '%" & txt_Month.Text & "%'"我只知道对于日期型的在SQL语句中 一般是用 #
但是也可以将他改为字符型
'不知我这样改行不行.
'另类改法
Adodc1.RecordSource ="select * from tb_JSQK where " & format(cstr(in_date),"yyyy/mm/dd" & " like '%" & format(txt_Month.Text,"yyyy/mm") & "%'"
'以上是我一时即性改的.不知有没有语法错误.
"select * from tb_JSQK where convert(vrachar(7),in_date,120)= '" & format(txt_Month.Text,"yyyy-mm") & "'"