翻阅古今
//下面代码针对sqlserver的 Q是AdoQuery 组件//备份var sql:String;beginif (filename.Text='') thenbeginApplication.MessageBox('请选择文件','提示',MB_ICONWARNING);exit;end;sql:='BACKUP DATABASE "mao" TO DISK ='''+filename.Text+''' with init';Q.SQL.Text:=sql;q.ExecSQL;Application.MessageBox('数据库备份成功','提示',MB_ICONWARNING);end;//还原var sql:String;beginif (fname.Text='') thenbeginApplication.MessageBox('请选择文件','提示',MB_ICONWARNING);exit;end;Q.SQL.Text:='use master';Q.ExecSQL;sql:='RESTORE DATABASE "mao" FROM DISK='''+fname.Text+'''';Q.SQL.Text:=sql;q.ExecSQL;Q.SQL.Text:='Use mao';Q.ExecSQL;Application.MessageBox('数据库还原成功','提示',MB_ICONWARNING);