么
么哈么哈
Unregistered / Unconfirmed
GUEST, unregistred user!
var
FormQuery: TFormQuery;
slBC : TStringList;
slEC : TStringList;
implementation
{$R *.DFM}
procedure TFormQuery.edAANoExit(Sender: TObject);
var
Query : TQuery;
iID : integer;
begin
if trim(edAA.text)='' then exit;
Query := Query.Create(self);
with Query do begin
Close;
sql.clear;
sql.add(' select id iID from table1 where col1='+''''+edAA.Text+'');
Open;
iID:= FieldByName('id').asinteger;
end;
slBC.Clear;
slEC.Clear;
with Query do begin
Close;
sql.clear;
sql.add('select date_no,to_char(begin_date,''yyyy/mm/dd'')||''~''||to_char(end_date,''yyyy/mm/dd'') date_view from table2 where ID ='+IntToStr(iID));
Open;
combox1.Items.Clear;
combox2.Items.Clear;
while not eof do begin
combox1.Items.Add(FieldByName('date_view').AsString);
slBC.Add(FieldByName('date_view').AsString+'='+inttostr(FieldByName('date_no').AsInteger));
combox2.Items.Add(FieldByName('date_view').AsString);
slEC.Add(FieldByName('date_view').AsString+'='+inttostr(FieldByName('date_no').AsInteger));
next;
end;
end;
combox1.Enabled:= True;
combox1.Text := combox1.Items.Strings[0];
combox1.ItemIndex := 0;
combox2.Enabled:= True;
combox2.Text := combox2.Items.Strings[0];
combox2.ItemIndex := 0;
end;
每次程序运行到清空slBC : TStringList; slEC : TStringList;语句
slBC.Clear;
slEC.Clear;
就报错acess violation at address 004AC865 in module 'Query.exe' ,read of
address 00000000,process stopped,use step runto countinue.
如果注释这两行就会在下面有slBC的地方出错。
我该怎么办????????????????
FormQuery: TFormQuery;
slBC : TStringList;
slEC : TStringList;
implementation
{$R *.DFM}
procedure TFormQuery.edAANoExit(Sender: TObject);
var
Query : TQuery;
iID : integer;
begin
if trim(edAA.text)='' then exit;
Query := Query.Create(self);
with Query do begin
Close;
sql.clear;
sql.add(' select id iID from table1 where col1='+''''+edAA.Text+'');
Open;
iID:= FieldByName('id').asinteger;
end;
slBC.Clear;
slEC.Clear;
with Query do begin
Close;
sql.clear;
sql.add('select date_no,to_char(begin_date,''yyyy/mm/dd'')||''~''||to_char(end_date,''yyyy/mm/dd'') date_view from table2 where ID ='+IntToStr(iID));
Open;
combox1.Items.Clear;
combox2.Items.Clear;
while not eof do begin
combox1.Items.Add(FieldByName('date_view').AsString);
slBC.Add(FieldByName('date_view').AsString+'='+inttostr(FieldByName('date_no').AsInteger));
combox2.Items.Add(FieldByName('date_view').AsString);
slEC.Add(FieldByName('date_view').AsString+'='+inttostr(FieldByName('date_no').AsInteger));
next;
end;
end;
combox1.Enabled:= True;
combox1.Text := combox1.Items.Strings[0];
combox1.ItemIndex := 0;
combox2.Enabled:= True;
combox2.Text := combox2.Items.Strings[0];
combox2.ItemIndex := 0;
end;
每次程序运行到清空slBC : TStringList; slEC : TStringList;语句
slBC.Clear;
slEC.Clear;
就报错acess violation at address 004AC865 in module 'Query.exe' ,read of
address 00000000,process stopped,use step runto countinue.
如果注释这两行就会在下面有slBC的地方出错。
我该怎么办????????????????