用ACCESS做的数据库换SQL SERVER 2000后备份出现的问题(100分)

  • 主题发起人 YXBS2129
  • 开始时间
Y

YXBS2129

Unregistered / Unconfirmed
GUEST, unregistred user!
原系统是用ACCESS做数据库的,但是现在将之改为SQL SERVER 2000做数据库.但是在备份时就老是备份原ACCESS的数据库文件'db',该怎么办呢.部分的相关代码如下
procedure Tshujubeifen.SpeedButton1Click(Sender: TObject);
begin
Application.CreateForm(TSelectDir, SelectDir);
SelectDir.DriveComboBox1.Text := ExtractFileDrive(Edit_path.Text);
if (FileExists(Edit_path.Text)) then
SelectDir.DirectoryListBox1.Directory := Edit_path.Text;
if (SelectDir.ShowModal = mrOK) then
Edit2_path.Text := SelectDir.DirectoryListBox1.Directory;
SelectDir.free;
end;

procedure Tshujubeifen.FormCreate(Sender: TObject);
var
SourcePath: string;
begin
inherited;
B_showmessage := true;
SourcePath := ExtractFileDir(Application.ExeName);
if (StrLen(PChar(SourcePath)) <> 3) then
SourcePath := SourcePath + '/';
Edit_path.Text := SourcePath + 'BACKUPDATA/' + formatdatetime('yyyymmdd', date);
end;

procedure Tshujubeifen.SpeedButton2Click(Sender: TObject);
var
SFilePath, DFilePath, SourcePath: string;
MesString: string;
OpStruc: TSHFileOpStruct; //在uses中添加shellapi
FromBuf, ToBuf: array[0..255] of Char;
ShouldCopy: Boolean;
sr: TSearchRec;
FileAttrs: Integer;
label COPYAGAIN;
begin
COPYAGAIN:
// 准备目录拷贝
FillChar(FromBuf, Sizeof(FromBuf), 0);
FillChar(ToBuf, Sizeof(ToBuf), 0);
// 设置OpStruc
with OpStruc do
begin
Wnd := Handle;
wFunc := FO_COPY;
pFrom := @FromBuf;
pTo := @ToBuf;
fFlags := FOF_NOCONFIRMATION or FOF_RENAMEONCOLLISION;
fAnyOperationsAborted := False;
hNameMappings := nil;
lpszProgressTitle := nil;
end;

SourcePath := ExtractFileDir(Application.ExeName);
if (StrLen(PChar(SourcePath)) <> 3) then
SourcePath := SourcePath + '/';
FillChar(FromBuf, Sizeof(FromBuf), 0);
FillChar(ToBuf, Sizeof(ToBuf), 0);
SFilePath := SourcePath + 'db';
StrPCopy(FromBuf, Pchar(SFilePath));
DFilePath := Edit_path.Text;
StrPCopy(ToBuf, Pchar(DFilePath));
 
Edit_path.Text := SourcePath + 'BACKUPDATA/' + formatdatetime('yyyymmdd', date);//备份到指定的文件夹BACKUPDATA中

Edit2_path.Text := SelectDir.DirectoryListBox1.Directory;//选择备份的文件db

请问如何改才能备份SQL SERVER 2000所建的数据库呢
 
backup database gdzcglxt to disk =''D:/abc/www.bak'' with init
 
同意楼上,或用一个新的备份文件.
 
添加with replace参数
 
能不能具体点,给点详细的代码好吗
 
多人接受答案了。
 
顶部