【delphi开源代码栏目提醒】:网学会员在delphi开源代码频道为大家收集整理了frm_dropTb.pas提供大家参考,希望对大家有所帮助!
unit frm_dropTb;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, XPMan, DB, ADODB;
type
TFrmDropTB = class(TForm)
ADOConn: TADOConnection;
GBxDBList: TGroupBox;
LBxDB: TListBox;
XPManifest1: TXPManifest;
BtnDrop: TButton;
Button1: TButton;
AComDrop: TADOCommand;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
procedure BtnDropClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FrmDropTB: TFrmDropTB;
implementation
{$R *.dfm}
procedure TFrmDropTB.FormCreate(Sender: TObject);
begin
Adoconn.ConnectionString:='Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=
DelphiClassical200';
AdoConn.Open;
AdoConn.GetTableNames(LBXDB.Items,false);
end;
procedure TFrmDropTB.BtnDropClick(Sender: TObject);
begin
if LbxDb.ItemIndex > -1 then
begin
with AComDrop do
begin
Commandtext:='Drop Table '+LBXDb.Items.Strings[LBxdb.ItemIndex];
Execute;
end;
LBXDB.Clear;
AdoConn.GetTableNames(LBXDB.Items,false);
end
else
showmessage('请选择数据表!!!');
end;
procedure TFrmDropTB.Button1Click(Sender: TObject);
begin
Close;
end;
end.