我的一个过程调用出错!一定给分!

Mark_zheng 2001-07-08 03:11:58
implementation

procedure addrecord (rec_num :integer ; project, card_type , card_me , exch_id , yearstring, monthstring : string );
var
pre_year,pre_month :string;
cqjc_sl,cqjc_je : integer;
begin
if (monthstring='01') then
begin
pre_month:='12';
pre_year:=inttostr(strtoint(yearstring)-1);
end
else
begin
pre_month:=inttostr(strtoint(monthstring)-1);
pre_year:=yearstring;
end;
messagedlg('ok, the month has changed!' , mtinformation,[mbok],0);
form1.query1.close;
form1.query1.sql.Clear;
form1.query1.sql.add('select cqjc_sl ,cqjc_je from exch_rep_month where rec_num=:rec_num yearsting=:yearstring and monthstring=:monthstring and exch_id=:exch_id');
form1.query1.parambyname('rec_num').asinteger:=rec_num;
form1.query1.parambyname('exch_id').asstring:=exch_id ;
form1.query1.parambyname('monthstring').asstring:=pre_month;
form1.Query1.open;
cqjc_sl:=form1.query1.fieldbyname('cqjc_sl').asinteger;
cqjc_je:=form1.query1.fieldbyname('cqjc_je').asinteger;
messagedlg('ok, the data has been selected',mtinformation ,[mbok],0);
form1.edit1.text:=inttostr(cqjc_sl);
form1.edit2.text:=inttostr(cqjc_je);
end;



{$R *.DFM}

procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
table1.active:=true;
table2.active:=true;
table3.active:=true;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
addrecord(2,'20010','200','10','825','2001','05');
end;


运行期间包错的代码是:
project project1.exe raised exception class edbengineerror with
message ' invalid use of keyword .
token : yearstring=?
line number :1' process stopped use step or run to continue!

我已经对YESRSTRING赋值了呀!为什么?
请讲清楚原因,一定给分的·!
...全文
55 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Mark_zheng 2001-07-08
  • 打赏
  • 举报
回复
thank you !
呵呵!问题解决了!给分了!
但是你说的第一个问题不存在!是第二个中的 AND 没有写!
TechnoFantasy 2001-07-08
  • 打赏
  • 举报
回复
yearstring不能这样:yearsting=:yearstring 赋值。应该是Format('select * from dd where yearstring = %s',[yearstring])
另外where rec_num=:rec_num yearsting=:yearstring 中间没有bool连接,例如and 或者or什么的。
Mark_zheng 2001-07-08
  • 打赏
  • 举报
回复
为什么都不回答我的问题呀!其实这个问题很 简单呀!
Mark_zheng 2001-07-08
  • 打赏
  • 举报
回复
怎么还没有人回答呀!

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧