首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

关于Adoquery的有关问题,求解答!答案

2012-09-18 
关于Adoquery的问题,求解答!在线等答案先贴出代码吧:Delphi(Pascal) codeprocedure TFrmMain.Button2Click

关于Adoquery的问题,求解答!在线等答案
先贴出代码吧:

Delphi(Pascal) code
procedure TFrmMain.Button2Click(Sender: TObject);begin if cxTextEdit1.text='' then exit ;  if not idftp1.Connected then idftp1.Connect;  adoquery1.Connection:=adoconnection1;   ADOQuery1.Close;   ADOQuery1.Open;     showmessage(ADOQuery1.SQL.Text);  ADOQuery1.SQL.Text:='select filename from test where shno='''+    cxTextEdit1.text+'''';  Label1.caption:=adoquery1.FieldByName('filename').AsString ;end;

我的目的是先实现通过cxTextEdit1.text输入一个单号,查出匹配的数据再输到一个lable上
但是这样写总是报错:“无效的授权说明”
请高手解答一下或者给其它的源代码也行!!谢谢

[解决办法]
Delphi(Pascal) code
procedure TFrmMain.Button2Click(Sender: TObject);begin  if cxTextEdit1.text='' then exit ;  if not idftp1.Connected then idftp1.Connect;  if ADOConnection1.Connected then begin    adoquery1.Connection:=adoconnection1;    ADOQuery1.Close;    ADOQuery1.SQL.Text := 'select filename from test where shno= '+QuotedStr(cxTextEdit1.text);    showmessage(ADOQuery1.SQL.Text);    ADOQuery1.Open;    Label1.caption:=adoquery1.FieldByName('filename').AsString ;  end  else showmessage('ADOConnection1未连接。');end;
[解决办法]
ADOQuery1.SQL.Text 不能在 open 后才赋值。

热点排行