大家帮忙看下呀,我是新手,老是提示“不正常地定义参数对象。提供了不一致或不完整的信息。”在线等
代码如下:
procedure Ttsjh_frm.submit_btnClick(Sender: TObject);
var
I: Integer;
readerNM,bookNM,bookID: string;
borr_Q,addborr_Q:TadoQuery;
begin
if borrLend_pc.ActivePage=tabsheet3 then
if libcard_id.Text='' then
begin
messagebox(handle,'请输入借书证号!','添加记录出错',MB_OK or MB_iconError);
libcard_id.SetFocus;
exit;
end;
if (book_id.Text='') and (borrow_LB.items.Count=0) then
begin
messagebox(handle,'没有图书可以添加!','添加记录出错',MB_OK or MB_iconError);
book_id.SetFocus;
exit;
end;
if borrow_LB.items.Count>0 then
begin
borr_Q:=TadoQuery.Create(nil);
borr_Q.Connection:=connect;
addborr_Q:=TadoQuery.Create(nil);
addborr_Q.Connection:=connect;
for I := 0 to borrow_LB.items.Count-1 do
begin
bookID:=copy(borrow_LB.Items.Strings[i],1,10);
borr_Q.SQL.Clear;
borr_Q.SQL.Add('select book_name,reader_name from bookinf,readers');
borr_Q.SQL.Add('where bookinf.book_id=:bookID and readers.libcard_id=:cardID');
borr_Q.Parameters.ParamByName('bookID').Value:=bookID;
borr_Q.Parameters.ParamByName('cardID').Value:=libcard_id.Text;
borr_Q.Open;
readerNM:=borr_Q.FieldValues['reader_name'];
bookNM:=borr_Q.FieldValues['book_name'];
borr_Q.Close;
addborr_Q.SQL.Clear;
addborr_Q.SQL.Add('insert into records(libcard_id,reader_name,book_id,book_name,borrow_date,return_date,conborrow_date,status)');
addborr_Q.SQL.Add('values(:libcard_id,:reader_name,:book_id,:book_name,:borrow_date,isNull,isNull,:status)');
addborr_Q.Parameters.ParamByName('libcard_id').Value:=libcard_id.Text;
addborr_Q.Parameters.ParamByName('reader_name').Value:=readerNM;
addborr_Q.Parameters.ParamByName('book_id').Value:=bookID;
addborr_Q.Parameters.ParamByName('book_name').Value:=bookNM;
addborr_Q.Parameters.ParamByName('borrow_date').Value:=date();
addborr_Q.ExecSQL;
end;
addborr_Q.Close;
freeAndNil(addborr_Q);
freeAndNil(borr_Q);
showmessageFmt('成功添加%s本借书记录!',[inttostr(borrow_LB.items.Count)]);
end;
end;
错误提示框:
Debugger Exception Notification
.exe raised exception class EOleException with message '不正常地定义参数对象。提供了不一致或
不完整的信息。'.
Break Continue Help
Ignore this exception typ
在线等各位老大的回复