代码如下:
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在线等各位老大的回复

解决方案 »

  1.   

    应该是sql语句的问题,至少你得SQL.Add导致前后两句间无空格,先把这个解决再看
      

  2.   

    加了空格,错误依旧,
    点break 后问题指定在:
            addborr_Q.Parameters.ParamByName('borrow_date').Value:=date(); 
            addborr_Q.ExecSQL; 
          end; //break后指定错误处
          addborr_Q.Close; 
          freeAndNil(addborr_Q);
      

  3.   

    '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(); 
    你好像丢掉了一个status
      

  4.   

    :status  這個參數沒帶傳參數值。
      

  5.   

    又出现错误:
    Could not convert variant of type (Null) into type (OleStr)
    这个我知道,
    问题是怎么给时间类型空值