此程序为什么会死机??
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, Buttons, DB, ADODB;
type
TForm1 = class(TForm)
ListView1: TListView;
BitBtn1: TBitBtn;
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
with adoquery1 do
begin
close;
sql.Clear;
sql.Add('select * from tzb');
open;
listview1.Items.Clear ;
while not eof do
with listview1.Items.Add do
begin
caption:=fieldByName('jszh').AsString;
subitems.Add(fieldByName('xm').AsString);
subitems.Add(fieldByName('sfzh').AsString);
end;
next
end;
end;
end.我一运行此程序就死机,何解