语句1:Select * from where opendate = '2010-03-29'
正确的代码 能根据时间得到结果
语句2:Select * from where opendate = 2010-03-29
错误的代码 解释器不报错 但是得不到结果我用。net生成语句
用什么方法才能生成语句1那样子的语句?
正确的代码 能根据时间得到结果
语句2:Select * from where opendate = 2010-03-29
错误的代码 解释器不报错 但是得不到结果我用。net生成语句
用什么方法才能生成语句1那样子的语句?
Dim strSql
strSql="select * from where opendate='"&Date&"'"
dateadd(day,2010-03-29,0)
string strCondition = "openDate = '" + _date.ToShortDateString()+"'"我的查询条件是这样子生成的
把这个生成的语句放进去执行就没有结果了
@condition = N'beginDate = ''2010-03-25'''执行存储过程的时候 传进去的值是这样子的 但是解释器报错了 说''有错误 如果不加引号进去后就变成语句2的情况,加了引号又出错 怎么办?
引号要进行转义 ,转义符是'