L
lyj19851216
Unregistered / Unconfirmed
GUEST, unregistred user!
比如說我現在要創建表AA﹐但是我不知道庫中是否已經有了它的存在﹐那么先要進行判斷﹐怎么來判斷。。。我的代碼是這樣寫的﹐但是不對﹐哪位高手知道的指教下。。。
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
q.Close;
q.SQL.Clear;
q.SQL.Add('select * from mmn');
try
begin
q.Open;
if q.Active=true then
begin
showmessage('~~~');
end;
end;
except
begin
q.Close;
q.SQL.Clear;
q.SQL.Add('create table mmn(id int,nu char(4)) select * from mmn');
q.Open;
showmessage('OK!');
end;
end;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
q.Close;
q.SQL.Clear;
q.SQL.Add('select * from mmn');
try
begin
q.Open;
if q.Active=true then
begin
showmessage('~~~');
end;
end;
except
begin
q.Close;
q.SQL.Clear;
q.SQL.Add('create table mmn(id int,nu char(4)) select * from mmn');
q.Open;
showmessage('OK!');
end;
end;
end;