vb中如何写sql查询条件
s和ss,sover都为stringTmpSource="SELECTl.Send_datetimeas发送时间,l.MsgContentas短信内容"_+"FROMSe...
s 和 ss,sover都为string
TmpSource = "SELECT l.Send_datetime as 发送时间,l.MsgContent as 短信内容" _
+ " FROM SendHistory l WHERE Send_datetime like +" _
+ " '" + s + "%'" And Send_datetime > ss And Send_datetime < sover
现在编译的时候说类型不匹配 是不是like后的换行符引起的错误啊 展开
TmpSource = "SELECT l.Send_datetime as 发送时间,l.MsgContent as 短信内容" _
+ " FROM SendHistory l WHERE Send_datetime like +" _
+ " '" + s + "%'" And Send_datetime > ss And Send_datetime < sover
现在编译的时候说类型不匹配 是不是like后的换行符引起的错误啊 展开
2个回答
展开全部
哈哈,Send_datetime like +",把加号删除,
"%'" And Send_datetime > ss And Send_datetime < sover 这段缺少了很多引号和+号。自己加上。
我修改了一个,你在调试下。
TmpSource = "SELECT l.Send_datetime as 发送时间,l.MsgContent as 短信内容" _
+ " FROM SendHistory l WHERE Send_datetime like " _
+ " '" + s + "%'" + " And Send_datetime > '" + ss + "' And Send_datetime < "' + sover + "'"
调试的方法:
如果是BS程序,就写 response.write TmpSource
如果是CS程序,就写 print TmpSource
将sql语句显示出来看看哪儿错了。
"%'" And Send_datetime > ss And Send_datetime < sover 这段缺少了很多引号和+号。自己加上。
我修改了一个,你在调试下。
TmpSource = "SELECT l.Send_datetime as 发送时间,l.MsgContent as 短信内容" _
+ " FROM SendHistory l WHERE Send_datetime like " _
+ " '" + s + "%'" + " And Send_datetime > '" + ss + "' And Send_datetime < "' + sover + "'"
调试的方法:
如果是BS程序,就写 response.write TmpSource
如果是CS程序,就写 print TmpSource
将sql语句显示出来看看哪儿错了。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询