帮我看下程序,老提示有错误
程序老提示project project2.exe raised exception class EAccessViolation with message'Access violation at address 0048cbfe in module'project2.exe'.read of address 000002f8'. process stoped.use step or run to continue.这是怎么回事啊,要怎么改啊,下面是程序帮我看看,谢谢!unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, DB, ADODB;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
ADOQuery1: TADOQuery;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses main;
{$R *.dfm}
procedure TForm1.BitBtn1Click(Sender: TObject);
var
id,pwd:string;
begin
id:=edit1.text;
pwd:=edit2.text;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:='select * from user where userid='''+id+''' and userpwd='''+pwd+'''';
adoquery1.Open;
if adoquery1.Recordset.RecordCount=0 then
begin
showmessage('用户或者密码输入错误,请重输!');
edit1.SetFocus;
end
else begin
hide;
mainform.ShowModal;
end;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
application.Terminate;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
edit1.Clear;
edit2.Clear;
adoquery1.Connection:=main.mainform.ADOConnection1;
end;
end.