当前位置:编程学习 > Delphi >>

delphi ‘’=‘附近有语法错误

procedure TForm1.Button1Click(Sender: TObject); begin ADOQuery1.Close; ADOQuery1.SQL.Clear; ADOQuery1.SQL.Add('select * from @table=:b'); ADOQuery1.Parameters.ParamByName('b').Value:=trim(ComboBox1.Text); ADOQuery1.Active:=true; ADOQuery1.ExecSQL; ADOQuery1.Open; end; 提示有错误 实现不了 需要怎么改?
答案:第3 - 7句改成
ADOQuery1.SQL.Add('select * from '+trim(ComboBox1.Text));
ADOQuery1.Active:=true;
就可以了。
注意只需要任意一个ADOQuery1.Active:=true; /ADOQuery1.ExecSQL; / ADOQuery1.Open; ,它们的用处是一样的。
其他:好长时间没用delphi了,我记得,直接ADOQuery1.ExecSQL;就可以了。
ADOQuery1.Open和ADOQuery1.Active:=true;不需要。 ADOQuery1.SQL.Add('select * from @table=:b');
这句有问题吧! where呢? 

上一个:.rpt是什么文件,在Delphi中怎么用?
下一个:delphi中,用 Label1.Caption:=DateTimetostr((now())); 读取的系统时间里面有:号,如何把冒号变为 _

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,