请帮我看一下 帮帮忙阿高手求.......日期 和其他条件用变量]处理(20分)

  • 主题发起人 主题发起人 wyismail
  • 开始时间 开始时间
W

wyismail

Unregistered / Unconfirmed
GUEST, unregistred user!
select count(*) as t from casetable c ,property p
where c.propertycode = p.propertycode and
substring(c.propertycode,1,6) =
(select propertycode from property where name='违反爆炸物品管理规定' and deleteflag=0 )
and c.catchtime >='2002-10-01' and c.catchtime <'2002-12-30 '
 
改成这样的形式
and convert(char(10),c.catchtime,21) >='2002-10-01'
and convert(char(10),c.catchtime,21) <'2002-12-30 '
 
hi楼 上的谢谢阿 若用动态参数那我下面的有什么问题阿
var CCaseharmSqlStr:string;
startdate,enddate:Tdatetime;
begin
startdate:=2002-10-10;
enddate:=2002-12-30;

CCaseharmSqlStr:=
{'select count(*) as t from casetable c ,property p '+
' where c.propertycode = p.propertycode'+
' and substring(c.propertycode,:par1,:par2)=(select propertycode from property where name=:LineName and deleteflag = 0) '+
' and c.catchtime >=:StartDate and c.catchtime <:EndDate ';
}

ADOQuery1.Parameters[0].value:=1;
ADOQuery1.Parameters[1].value:= 6;
ADOQuery1.Parameters[2].value := '违反爆炸物品管理规定';
ADOQuery1.Parameters[3].Value:='2002-11-30';
ADOQuery1.Parameters[4].value:='2002-12-30';}
ADOQuery1.open;
 
类型不对
 
说仔细点阿兄弟
 
接受答案了.
 
后退
顶部