全部博文(788)
分类:
2009-05-12 16:04:35
ADOQuery1.SQL.Add('select cpn from saveque where rdate?')
adquser.Parameters.ParamByName('??').Value:=datetostr(DateTimePicker1.Date)
select cpn from saveque where rdate<'''+'#'+datetostr(DateTimePicker1.Date)+'#'+''
注意rdate<'''这里再加两个引号
这样写是对的,我验证过了:
select cpn from saveque where rdate<#'+datetostr(DateTimePicker1.Date)+'#'
mssql 中这样写select cpn from saveque where rdate<'+datetostr(DateTimePicker1.Date);
指定查找范围(mssql):select cpn from saveque where rdate between ''' + datettostr(datetimepicker1.date) + ''' and ''' + datettostr(datetimepicker2.date) + ''''
mssql 中这样写select cpn from saveque where rdate<'+datetostr(DateTimePicker1.Date);
---------------------------------------
不好意思,应该是:
sqlstr:='select cpn from saveque where rdate<'''+datetostr(DateTimePicker1.Date) + '''';
最好的方法是这样的:
'select cpn from saveque where rdate<:aa '
然后再在adoquery1.open前面放上下面这一句就可以啦.
adoquery1.Parameters.ParamByName('aa').Value:=trim(DateTimePicker1.Date);
在access 和sqlsever中通杀!
最后一个最简单明了!结帖!参与有分!谢谢!
结帖