主题:[求助]Delphi7中我的程序为什么会出现这样的问题?
小M我的程序至今没有改出来,请各位大侠再帮帮忙,改下错,拜托啦~~~~~~~~~~小M一定感激得五体投地!!!!
以下是我的程序:
procedure TBookAdd.Button1Click(Sender: TObject);
begin
if(trim(CodeEdit.Text)='' )then
begin
showmessage('书号不能为空');
exit;
end;
if(trim(NameEdit.Text)='' )then
begin
showmessage('书名不能为空');
exit;
end;
if(trim(AuthorEdit.Text)='' )then
begin
showmessage('作者不能为空');
exit;
end;
if(trim(PressEdit.Text)='' )then
begin
showmessage('出版社不能为空');
exit;
end;
if(trim(OutTimeEdit.Text)='' )then
begin
showmessage('出版时间不能为空');
exit;
end;
if(trim(CostEdit.Text)='' )then
begin
showmessage('价格不能为空');
exit;
end;
if(trim(Edit1.Text)='' )then
begin
showmessage('数量不能为空');
exit;
end;
if(trim(ComboBox2.Text)='' )then
begin
showmessage('类别不能为空');
exit;
end;
if(trim(Edit3.Text)='' )then
begin
showmessage('位置不能为空');
exit;
end;
ADOQuery1.Close ;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select 书号 from 图书信息表 where 书号 =:A1');
ADOQuery1.Parameters.ParamByName ('A1').Value :=CodeEdit.Text;
ADOQuery1.Open;
if ADOQuery1.RecordCount <> 0 then
begin
MessageDlg('书号 <'+CodeEdit.Text+'> 已经存在',mtError,[mbok],0);
CodeEdit.SetFocus;
Exit;
end;
Close;
try
begin
ADOQuery1.Close ;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('insert into 图书信息表(书号,书名,作者,出版社,出版日期,价格,备注,数量,类别,位置)');
ADOquery1.SQL.add('Values(:A1,:A2,:A3,:A4,:A5,:A6,:A7,:A8,:A9,:A10)');
ADOQuery1.Parameters.ParamByName ('A1').Value :=CodeEdit.Text;
ADOQuery1.Parameters.ParamByName ('A2').Value :=NameEdit.Text;
ADOQuery1.Parameters.ParamByName ('A3').Value :=AuthorEdit.Text;
ADOQuery1.Parameters.ParamByName ('A4').Value :=PressEdit.text;
try
ADOQuery1.Parameters.ParamByName ('A5').Value :=StrToDate(OutTimeEdit.Text);
except
MessageDlg('参数 <出版时间> 设置错误',mtError,[mbok],0);
Exit;
end;
ADOQuery1.Parameters.ParamByName ('A6').Value :=CostEdit.Text;
ADOQuery1.Parameters.ParamByName ('A7').Value :=Memo1.Text;
ADOQuery1.Parameters.ParamByName ('A8').Value :=Edit1.Text;
ADOQuery1.Parameters.ParamByName ('A9').Value :=ComboBox2.Text;
ADOQuery1.Parameters.ParamByName ('A10').Value :=Edit3.text;
ADOQuery1.ExecSQL ;
showmessage('添加成功!');
CodeEdit.Text:='';
NameEdit.Text:='';
AuthorEdit.Text:='';
PressEdit.Text:='';
OutTimeEdit.Text:='';
CostEdit.Text:='';
Memo1.Text:='';
Edit1.Text:='';
ComboBox2.Text:='';
Edit3.Text:='';
except
MessageDlg('入库出错',mtError,[mbok],0);
end;
end;
错误信息为:
[Error] fbookadd.pas(188): 'END' expected but 'EXCEPT' found
[Error] fbookadd.pas(190): EXCEPT or FINALLY expected
[Fatal Error] mainform.pas(100): Could not compile used unit 'fbookadd.pas'
怎么会这样呢??????????????????????
请帮帮我~~~~~~~~~~
以下是我的程序:
procedure TBookAdd.Button1Click(Sender: TObject);
begin
if(trim(CodeEdit.Text)='' )then
begin
showmessage('书号不能为空');
exit;
end;
if(trim(NameEdit.Text)='' )then
begin
showmessage('书名不能为空');
exit;
end;
if(trim(AuthorEdit.Text)='' )then
begin
showmessage('作者不能为空');
exit;
end;
if(trim(PressEdit.Text)='' )then
begin
showmessage('出版社不能为空');
exit;
end;
if(trim(OutTimeEdit.Text)='' )then
begin
showmessage('出版时间不能为空');
exit;
end;
if(trim(CostEdit.Text)='' )then
begin
showmessage('价格不能为空');
exit;
end;
if(trim(Edit1.Text)='' )then
begin
showmessage('数量不能为空');
exit;
end;
if(trim(ComboBox2.Text)='' )then
begin
showmessage('类别不能为空');
exit;
end;
if(trim(Edit3.Text)='' )then
begin
showmessage('位置不能为空');
exit;
end;
ADOQuery1.Close ;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select 书号 from 图书信息表 where 书号 =:A1');
ADOQuery1.Parameters.ParamByName ('A1').Value :=CodeEdit.Text;
ADOQuery1.Open;
if ADOQuery1.RecordCount <> 0 then
begin
MessageDlg('书号 <'+CodeEdit.Text+'> 已经存在',mtError,[mbok],0);
CodeEdit.SetFocus;
Exit;
end;
Close;
try
begin
ADOQuery1.Close ;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('insert into 图书信息表(书号,书名,作者,出版社,出版日期,价格,备注,数量,类别,位置)');
ADOquery1.SQL.add('Values(:A1,:A2,:A3,:A4,:A5,:A6,:A7,:A8,:A9,:A10)');
ADOQuery1.Parameters.ParamByName ('A1').Value :=CodeEdit.Text;
ADOQuery1.Parameters.ParamByName ('A2').Value :=NameEdit.Text;
ADOQuery1.Parameters.ParamByName ('A3').Value :=AuthorEdit.Text;
ADOQuery1.Parameters.ParamByName ('A4').Value :=PressEdit.text;
try
ADOQuery1.Parameters.ParamByName ('A5').Value :=StrToDate(OutTimeEdit.Text);
except
MessageDlg('参数 <出版时间> 设置错误',mtError,[mbok],0);
Exit;
end;
ADOQuery1.Parameters.ParamByName ('A6').Value :=CostEdit.Text;
ADOQuery1.Parameters.ParamByName ('A7').Value :=Memo1.Text;
ADOQuery1.Parameters.ParamByName ('A8').Value :=Edit1.Text;
ADOQuery1.Parameters.ParamByName ('A9').Value :=ComboBox2.Text;
ADOQuery1.Parameters.ParamByName ('A10').Value :=Edit3.text;
ADOQuery1.ExecSQL ;
showmessage('添加成功!');
CodeEdit.Text:='';
NameEdit.Text:='';
AuthorEdit.Text:='';
PressEdit.Text:='';
OutTimeEdit.Text:='';
CostEdit.Text:='';
Memo1.Text:='';
Edit1.Text:='';
ComboBox2.Text:='';
Edit3.Text:='';
except
MessageDlg('入库出错',mtError,[mbok],0);
end;
end;
错误信息为:
[Error] fbookadd.pas(188): 'END' expected but 'EXCEPT' found
[Error] fbookadd.pas(190): EXCEPT or FINALLY expected
[Fatal Error] mainform.pas(100): Could not compile used unit 'fbookadd.pas'
怎么会这样呢??????????????????????
请帮帮我~~~~~~~~~~