with adoquery1 do
try
close;
sql.Clear;
sql.Add('use ');
sql.Add('exec sp_addumpdevice ''disk'',''mydiskdevice'',''d:\data\backup\.bak'''); sql.Add('backup database to mydiskdevice'); execsql;
finally;
end;这样执行不了
有谁能教教我吗
顺便教我恢复阿,谢谢先了
try
close;
sql.Clear;
sql.Add('use ');
sql.Add('exec sp_addumpdevice ''disk'',''mydiskdevice'',''d:\data\backup\.bak'''); sql.Add('backup database to mydiskdevice'); execsql;
finally;
end;这样执行不了
有谁能教教我吗
顺便教我恢复阿,谢谢先了
备份数据库
procedure QuickCopyTable(T: TTable; DestTblName: string; Overwrite: Boolean);varDBType: DBINAME;WasOpen: Boolean;NumCopied: Word;begin//save table active stateWasOpen := T.Active;if not WasOpen then T.Open; //ensure the table is open//Get driver type stringCheck(DbiGetProp(hDBIObj(T.Handle), drvDRIVERTYPE, @DBType, SizeOf(DBINAME), NumCopied));//Copy the tableCheck(DBICopyTable(T.DBHandle, Overwrite, PChar(T.Tablename),DBType, PChar(DestTblName)));//Restore active stateT.Active := WasOpen;end;
backup database databasename to disk='d:\server\jun.bak' with init //备分
这是2个sql 语句,添加到adoquery1.sql.add();里面就可以拉
MyFileName: string;
begin
MyFileName := '';
try
if SaveDialog1.Execute then
begin
MyFileName := SaveDialog1.FileName;
if MyFileName <> '' then
begin
if CopyFile(Pchar(ExtractFilePath(Application.ExeName) + 'shoufa.mdb'), Pchar(MyFileName), false) then
begin
Application.MessageBox('数据备份成功','提示',Mb_ok + mb_iconinformation);
end;
end;
end;
except
Application.MessageBox('数据备份失败','提示',Mb_ok + mb_iconError);
end;
恢复:
var
MyFileName, aa: string;
begin
MyFileName := '';
try
if OpenDialog1.Execute then
begin
MyFileName := OpenDialog1.FileName;
if MyFileName <> '' then
begin
aa := ExtractFilePath(Application.ExeName) + 'shoufa.mdb';
if CopyFile(Pchar(MyFileName),Pchar(aa), false) then
begin
DataM.ADOConnection1.Close;
DataM.ADOConnection1.Open;
Application.MessageBox('数据恢复成功','提示',Mb_ok + mb_iconinformation);
end;
end;
end;
except
Application.MessageBox('数据恢复失败','提示',Mb_ok + mb_iconError);
end;
对了,我想问下
所谓的二次提交指的是什么?
access数据库如何实现二次提交呢?
以前我用SQL的时候实现二次提交的代码怎么到了access就不能成功呢?
ADOTable1.UpdateBatch(arAll);
ADOTable1.CancelBatch(arAll);