2
2008hyc
Unregistered / Unconfirmed
GUEST, unregistred user!
程序老提示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.这是怎么回事啊,要怎么改啊,下面是程序帮我看看,谢谢!<br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, StdCtrls, Buttons, DB, ADODB;<br><br>type<br> TForm1 = class(TForm)<br> Label1: TLabel;<br> Label2: TLabel;<br> Edit1: TEdit;<br> Edit2: TEdit;<br> BitBtn1: TBitBtn;<br> BitBtn2: TBitBtn;<br> ADOQuery1: TADOQuery;<br> procedure BitBtn1Click(Sender: TObject);<br> procedure BitBtn2Click(Sender: TObject);<br> procedure FormCreate(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>uses main;<br><br>{$R *.dfm}<br><br>procedure TForm1.BitBtn1Click(Sender: TObject);<br><br>var<br>id,pwd:string;<br>begin<br>id:=edit1.text;<br>pwd:=edit2.text;<br>adoquery1.Close;<br>adoquery1.SQL.Clear;<br>adoquery1.SQL.Text:='select * from user where userid='''+id+''' and userpwd='''+pwd+'''';<br>adoquery1.Open;<br>if adoquery1.Recordset.RecordCount=0 then<br> begin<br> showmessage('用户或者密码输入错误,请重输!');<br> edit1.SetFocus;<br> end<br> else begin<br> hide;<br> mainform.ShowModal;<br> end;<br>end;<br><br>procedure TForm1.BitBtn2Click(Sender: TObject);<br>begin<br>application.Terminate;<br>end;<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br>edit1.Clear;<br>edit2.Clear;<br>adoquery1.Connection:=main.mainform.ADOConnection1;<br>end;<br>end.