代码如下:
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在线等各位老大的回复
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在线等各位老大的回复
解决方案 »
- delphi 新学,ADOQuery 未发现字段
- 【高分】,求助如何实现Windows自动注销
- 急需delphi的支持50個用戶的license key:
- ExpressDBTree 1.31
- 请教高手,谢谢帮助!~_~
- 有关数据库事务的问题
- win2000下内存使用的问题?
- socket编程的问题,如何突破防火墙!
- 我创建了一个TListView类型的listview,可是不能通过程序给他添加项目,要怎样才能实现呀?
- 请教上下健的健值是什么我知道回车是13
- 有一段base64编码的字符串,在简体windows下解码正常,但在繁体系统下乱码!使用的是D2009
- 认为删除了程序目录下的一些dll文件导致程序异常,这些算不算软件没有健壮性?
点break 后问题指定在:
addborr_Q.Parameters.ParamByName('borrow_date').Value:=date();
addborr_Q.ExecSQL;
end; //break后指定错误处
addborr_Q.Close;
freeAndNil(addborr_Q);
上面有六个参数
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();
你好像丢掉了一个status
Could not convert variant of type (Null) into type (OleStr)
这个我知道,
问题是怎么给时间类型空值