各位大虾:
小的,有条Update语句太长了,不知道如何分割开:
CmdStr:='Update zotheruserlist';
CmdStr:=CmdStr+Format(' Set zusertype=%d,...where zotheruserid=%d',[TypeID,...StrToInt(CarderNo.Text)]);
SQL.Add(CmdStr);
ExecSQL;
请教:怎样把第二条CmdStr:=CmdStr+Format...分成两至三段。。
能不能这么分:
CmdStr:='Update zotheruserlist';
CmdStr:=CmdStr+Format(' Set zusertype=%d,...');
CmdStr:=CmdStr+Format(' Where zotheruserid=%d',[TypeID,...StrToInt(CarderNo.Text)]);
SQL.Add(CmdStr);
ExecSQL;
请教!
我试了,还是不行,最主要的是[TypeID,...StrToInt(CarderNo.Text)]这一部分还有.用两个Format对吗??
请教!!!
各位大虾,小的很很急需解决的!!!
小的,有条Update语句太长了,不知道如何分割开:
CmdStr:='Update zotheruserlist';
CmdStr:=CmdStr+Format(' Set zusertype=%d,...where zotheruserid=%d',[TypeID,...StrToInt(CarderNo.Text)]);
SQL.Add(CmdStr);
ExecSQL;
请教:怎样把第二条CmdStr:=CmdStr+Format...分成两至三段。。
能不能这么分:
CmdStr:='Update zotheruserlist';
CmdStr:=CmdStr+Format(' Set zusertype=%d,...');
CmdStr:=CmdStr+Format(' Where zotheruserid=%d',[TypeID,...StrToInt(CarderNo.Text)]);
SQL.Add(CmdStr);
ExecSQL;
请教!
我试了,还是不行,最主要的是[TypeID,...StrToInt(CarderNo.Text)]这一部分还有.用两个Format对吗??
请教!!!
各位大虾,小的很很急需解决的!!!
解决方案 »
- 求助advstringgrid的帮助文档
- 如何用query组件,来执行存储过程???存储过程有结果返回,如何取得呢?急。。。。。。。。。。。。。。。。。。
- 菜鸟急问个小问题
- 怎麼把cxgrid中的數據保存到excel中?
- 请各路老鸟帮帮忙,告诉我在Delphi7中如何安装QuickReport
- 小女子有问题求教 50分 我的程序用InstallShield打包分发后,我程序里用到的*.dll文件会在用户机器上自动注册吗
- 关于ListBox的问题.
- 求助!!!
- 国庆Delphi版的朋友也不能闲着呀!我们也聚会呀!(当然PLMM越多越好)!之二(UP有分
- Help me!3cs first
- 如何实现远程数据库的共享?100分!!!
- 制作试用版程序???
CmdStr: string;
begin
CmdStr := '';
CmdStr := 'Update zotheruserlist' CmdStr := CmdStr + Format('Set zusertype=%d,zname=''%s'',zsex=''%s'',zbirthdate=''%s''',[TypeID,Trim(CarderName.Text),Trim(CarderSex.Text),DateToStr(BorthTime.Date)]); CmdStr := CmdStr+Format('znationality=%d,zbelongtocity=%d,zbelongtozone=%d,zidnumber=''%s'',ztempresid=''%s''', [NationID,ProvinceID,CountyID,Trim(CarderIdentity.Text),Trim(CarderStayed.Text)]); CmdStr := CmdStr + Format('ztempresexpire=''%s'',zpassportnum=''%s'',zemail=''%s'',zworkingcompany=''%s'',zphonenumber=''%s''',[DateToStr(StayedTime.Date),Trim(CarderPass.Text), Trim(CarderEmail.Text),Trim(CarderUnit.Text),Trim(CarderTel.Text)]); CmdStr := CmdStr + Format('zcellularnumber=''%s'',zaddress=''%s'',zpostcode=%d Where zotheruserid=%d',[Trim(CarderMobil.Text),Trim(CarderAddress.Text),IntToStr(Trim(CarderMail.Text)),Trim(CarderNo.Text)]); SQL.text := CmdStr;
end;
------------------------------------------------------------------------------------
建议看一下delphi帮助中format的用法.
不过在调试时,还是出错了》在倒数第二条:CmdStr := CmdStr + Format('zcellularnumber=''%s'',zaddress=''%.....
他的提示是:Project ConsumeApp.exe raise exception class EConvertError with message 'Format'%d'' invalid or incompatible with argument'.
什么问题,请教,能不能快回!小的急着赶工!!!
CmdStr := CmdStr + Format('zcellularnumber=''%s'',zaddress=''%s'',zpostcode=%d Where zotheruserid=%d',[Trim(CarderMobil.Text),Trim(CarderAddress.Text),IntToStr(Trim(CarderMail.Text)),IntToStr(Trim(CarderNo.Text))]);
CmdStr:='Update zotheruserlist'
CmdStr:=CmdStr+'set zusertype='+#39+TypeID+#39;
.
.
.
CmdStr:=CmdStr+'where zotheruserid='+#39+TypeID+#39;
.
.
.
SQL.Add(CmdStr);
%s代表string类型; %d代表Decimal类型;
CmdStr := CmdStr + Format('zcellularnumber=''%s'',zaddress=''%s'',zpostcode=''%s'' Where zotheruserid=''%s'',[Trim(CarderMobil.Text),Trim(CarderAddress.Text),IntToStr(Trim(CarderMail.Text)),Trim(CarderNo.Text)]);
把不匹配的%d改为%s试试,要加上''号;
不行阿!
还是出现那种错误。
我还专把%d的类型放在最后了,都不行。
怎么解决阿!
还有什么高招吗??
请教!