
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, DB, DBTables;
type
TForm1 = class(TForm)
Memo1: TMemo;
Label1: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Query1: TQuery;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
try
with Query1 do
begin
close;
SQL.clear;
SQL.Add('exec sp_detach_db "DB2010","true"');
ExecSQL;
end;
Application.MessageBox('数据库分离成功!','提示',64);
Except
Application.MessageBox('数据库分离失败!','提示',64);
end;
end;
end.