用参数
query1.clear;
query1.sql.add('where (rq>=:todate)and(rq<=:fromdate)and(spy='''+spyedit.text+''')');
query1.parambyname('todate').asdatetime:=strtodate(edit1.text);
query1.parambyname('fromdate').asdatetime:=strtodate(edit2.text);
query1.prepare;
query1.open;
query1.clear;
query1.sql.add('where (rq>=:todate)and(rq<=:fromdate)and(spy='''+spyedit.text+''')');
query1.parambyname('todate').asdatetime:=strtodate(edit1.text);
query1.parambyname('fromdate').asdatetime:=strtodate(edit2.text);
query1.prepare;
query1.open;
解决方案 »
- 求助!能不能帮忙把下面几小段Delphi语句转换成C#语句? 分不够可以再给. 很急,在线等...
- 关于TDBGrid控件中数据的检测!请各位朋友帮帮忙!
- 用QUICKREPORT中的 TQRexpr控件显示时出现 “field emp_no is unknown type”问题怎么解决?
- 主板序列号问题! 帮帮忙吧!
- TQuickRep的小问题
- DSPack控件使用问题:不能捕捉声音啊
- 窗体问题,急急急急急急急急急急!!!!
- 如何删除stringgrid中的某一行?
- 我用WM_LBUTTONDBLCLK消息怎么对不上窗口还原呀,那到底是哪个?
- delphi with excel
- 密码验证与表连接的问题
- 求:判断一个字符在一个字符串里出现次数的函数.
2.75 1/1/1900 6:00 pm
-1.25 12/29/1899 6:00 am
35065 1/1/1996 12:00 am
To find the fractional number of days between two dates, simply subtract the two values, unless one of the TDateTime values is negative. Similarly, to increment a date and time value by a certain fractional number of days, add the fractional number to the date and time value if the TDateTime value is positive.
When working with negative TDateTime values, computations must handle time portion separately. The fractional part reflects the fraction of a 24-hour day without regard to the sign of the TDateTime value. For example, 6:00 am on 12/29/1899 is ?.25, not ? + 0.25, which would be ?.75. There are no TDateTime values between ? and 0.Note: Delphi 1.0 calculated the date from year 1 instead of from 1899. To convert a Delphi 1.0 date to a TDateTime value in later versions of Delphi or in Kylix, subtract 693594.0 from the Delphi 1.0 date. The date format changed to be more compatible with OLE 2.0 Automation.
var
date1:tdatetime;
begin
date1:=strtodatetime('2002-1-1 00:00:00');
if (date1>adoquery1.filedbyname('begindate').asdatetime) and (date1<adoquery1.filedbyname('enddate').asdatatime) then
begin
/////////////////////////////////////////////
end;
end;