dm1.bookcomm_q.SQL := 'Select * from Table1 where Field = :habitusno'; dm1.bookcomm_q.Parameters.ParamByName('habitusno').Integer :='2' dm1.bookcomm_q.Open
第一句错了,手上没有Delphi. 再补充一下: dm1.bookcomm_q.SQL.text := 'Select * from YourTable1Name where YourField = :habitusno'; dm1.bookcomm_q.Parameters.ParamByName('habitusno').Integer :='2' dm1.bookcomm_q.Open
补充一下,我的TableField的属性是字符型的,不好意思!!!!!!!1
他的parambyname('habitusno'). 后面没有ASString的属性
dm1.bookcomm_q.SQL.text := 'Select * from YourTable1Name where YourField = :habitusno'; dm1.bookcomm_q.Parameters.ParamByName('habitusno').value :='2' dm1.bookcomm_q.Open
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 为什么不可以。没有显示我要的结果
dm1.bookcomm_q.Parameters.ParamByName('habitusno').Integer :='2'
dm1.bookcomm_q.Open
dm1.bookcomm_q.SQL.text := 'Select * from YourTable1Name where YourField = :habitusno';
dm1.bookcomm_q.Parameters.ParamByName('habitusno').Integer :='2'
dm1.bookcomm_q.Open
dm1.bookcomm_q.Parameters.ParamByName('habitusno').value :='2'
dm1.bookcomm_q.Open
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
为什么不可以。没有显示我要的结果