|
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, DB, ADODB; type TForm1 = class(TForm) ado: TADOConnection; ad: TADOQuery; DataSource1: TDataSource; od: TOpenDialog; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var fn:string; begin if od.Execute then fn:=od.FileName; ad.Close; ad.SQL.Clear; ad.SQL.Add('restore database db1 from disk='+''''+fn+''''); try ado.Connected:=true; ad.ExecSQL; except showmessage('there is something wrong.'); end; end; end. |
|
|
|
你写这段函数的目的是什么??
在DELPHI中是不可以这么写的! 要用标准的SQL查询语句或者是CREATE TABLE之类的 |
|
|
这句SQL什么意思? WHERE子句不用的吗
|
|
|
各位大哥:我只想在程序中通过点击按钮实现数据库的备份与恢复,咋办呢?
|
|