在一段代码中需要帮助 [英] Need help in piece of code

查看:117
本文介绍了在一段代码中需要帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



以下是我的恢复命令



Hi all

Below is my restore command

RESTORE DATABASE " & cmbdatabase.Text & " FROM disk='" & OpenFileDialog1.FileName & "'  WITH MOVE 'a' TO 'C:\Backup\a.mdf', Move 'a_log' TO 'C:\Backup\a.ldf',REPLACE"





N.你可以看到我正在将.mdf和.ldf文件移动到某个位置。所以第一次移动它是好的,但是从第二次起它不允许我这样做。尽管它是'没有给出任何错误,但它没有给出所需的输出



请告诉我这方面的解决方案..



谢谢



Now as you can see i am moving the .mdf and .ldf file to a location.so for the first time it''s fine to move but from the second time it will not allow me to do so.although it''s not giving any error ,but it''s not giving the desired output

Please tell me the solution for this..

Thank you

推荐答案

我认为它与文件名有关。如果您要替换的文件与您用来替换它们的文件具有相同的名称,那么它将阻止您这样做。



从我自己的实践中,备份时,我通常用日期存储文件名,恢复时,我将它们重命名为我最初使用的文件名。这可以防止名称冲突,并有助于确定要还原的文件(更像是带日期的还原点)。
I think it has to do with the file names. If the files you want to replace has the same name with the ones you are using to replace them then it will prevent you from doing so.

From my own practice, when backing-up, I normally store the file names with dates and when restoring, I rename them to the file name that I used initially. This prevents names conflict and help to be exact with which files to restore (more like a restore point with dates).


这篇关于在一段代码中需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆