dm1.bookcomm_q.Parameters.ParamByName('habitusno'). ????? :='2';
   还要设置哪些属性,才可以让他得到值?谢谢各位了!!!!

解决方案 »

  1.   

    dm1.bookcomm_q.SQL := 'Select * from Table1 where Field = :habitusno';
    dm1.bookcomm_q.Parameters.ParamByName('habitusno').Integer :='2'
    dm1.bookcomm_q.Open
      

  2.   

    dm1.bookcomm_q.Parameters.ParamByName('habitusno').asstring:='2';
      

  3.   

    第一句错了,手上没有Delphi. 再补充一下:
    dm1.bookcomm_q.SQL.text := 'Select * from YourTable1Name where YourField = :habitusno';
    dm1.bookcomm_q.Parameters.ParamByName('habitusno').Integer :='2'
    dm1.bookcomm_q.Open
      

  4.   

    补充一下,我的TableField的属性是字符型的,不好意思!!!!!!!1
      

  5.   

    他的parambyname('habitusno').  后面没有ASString的属性
      

  6.   

    dm1.bookcomm_q.SQL.text := 'Select * from YourTable1Name where YourField = :habitusno';
    dm1.bookcomm_q.Parameters.ParamByName('habitusno').value :='2'
    dm1.bookcomm_q.Open
      

  7.   

    var
      bookcommU: TbookcommU;implementation
    uses DM,bookcommF;{$R *.dfm}procedure TbookcommU.Button1Click(Sender: TObject);
    begin
    bookcomm.ShowModal;
    end;procedure TbookcommU.RadioGroup1Click(Sender: TObject);
    begin
    case RadioGroup1.ItemIndex of
          1: begin
             dm1.bookcomm_q.Close;         dm1.bookcomm_q.Parameters.ParamByName('habitusno').Value:='2';         dm1.bookcomm_q.Open;
            end; 
         2:begin
             dm1.bookcomm_q.Close;         dm1.bookcomm_q.Parameters.ParamByName('habitusno').Value:='1';         dm1.bookcomm_q.Open;
            end;
    end
    end;procedure TbookcommU.FormActivate(Sender: TObject);
    begin
    dm1.bookcomm_q.Close;dm1.bookcomm_q.Open;
    end;end.
    我的bookcomm_q中的SQL 语句是
    select bookinfo.bookno,bookinfo.bookname,unitinfo.unitname,sphere.spherename,habitus.habitusname,habitus.habitusno from 
             bookinfo,unitinfo,sphere,habitus where  bookinfo.unitno=unitinfo.unitno 
              and bookinfo.sphereno=sphere.sphereno 
              and bookinfo.habitusno=habitus.habitusno
              and bookinfo.bookno=:habitusno  
    为什么不可以。没有显示我要的结果
      

  8.   

    dm1.bookcomm_q.Parameters.ParamByName('habitusno').Value :='2';