出现错误"ADOQuery1:missing SQL property"怎么回事? 10
unitUnit1;interfaceusesWindows,Messages,SysUtils,Variants,Classes,Graphics,Controls,F...
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, XPMan, StdCtrls, Buttons;
type
TFrmlogin = class(TForm)
Label1: TLabel;
Label2: TLabel;
XPManifest1: TXPManifest;
ADOquery: TADOQuery;
Edit1: TEdit;
usernamebox: TComboBox;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Frmlogin: TFrmlogin;
j:integer;
implementation
{$R *.dfm}
procedure TFrmlogin.FormCreate(Sender: TObject);
var
mypath:string;
begin
j:=0;
mypath:=extractfilepath(paramstr(0));
ADOquery.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+mypath+'data\data.mdb;Persist Security Info=False';
ADOquery.Active:=true;
with adoquery do//////到了这里就提示上面的错误
begin
close;
sql.Clear;
sql.Add('select * from user');
open;
if recordcount>0 then
begin
first;
while not eof do
begin
usernamebox.Items.Add(fieldbyname('username').AsString);
next;
end;
end
else
showmessage('当前没有用户');
end;
end;
end. 展开
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, XPMan, StdCtrls, Buttons;
type
TFrmlogin = class(TForm)
Label1: TLabel;
Label2: TLabel;
XPManifest1: TXPManifest;
ADOquery: TADOQuery;
Edit1: TEdit;
usernamebox: TComboBox;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Frmlogin: TFrmlogin;
j:integer;
implementation
{$R *.dfm}
procedure TFrmlogin.FormCreate(Sender: TObject);
var
mypath:string;
begin
j:=0;
mypath:=extractfilepath(paramstr(0));
ADOquery.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+mypath+'data\data.mdb;Persist Security Info=False';
ADOquery.Active:=true;
with adoquery do//////到了这里就提示上面的错误
begin
close;
sql.Clear;
sql.Add('select * from user');
open;
if recordcount>0 then
begin
first;
while not eof do
begin
usernamebox.Items.Add(fieldbyname('username').AsString);
next;
end;
end
else
showmessage('当前没有用户');
end;
end;
end. 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询