我完全迷失在这里,我的时间不多了。让我解释一下我的情况:
我用 C#express 2010 和 SQL Server Express 2008 R2 创建了一个软件。
现在,在我的软件的设置部分,用户应该能够手动备份/恢复数据库。
此外,他应该能够安排数据库备份,该备份将在他设置的时间运行。
我不知道如何让这两个工作发挥作用,我希望这里有人能给我指出正确的方向。
- 我需要能够创建一个
数据库的备份/恢复
单击按钮
- 我需要能够安排备份
流程
请记住,当用户在他的计算机上安装该软件时,他不会安装 sql server(我这么说是因为我的印象是 SMO 要求在客户端计算机上预先安装 sql server)。
谢谢
I am completely lost here and I am running out of time. Let me explain my situation:
I have created a software in C# express 2010 and SQL Server Express 2008 R2.
Now in the settings section of my software, the user is supposed to be able to make manual back ups/restores of the database.
Also he is supposed to be able to schedule back ups of the database, which will run at time that he will set.
I do not have a clue on how to get both of these working and I am hoping that someone here may point me in the correct direction.
- I need to be able to create a
backup/restore of the database from
the click of a button
- I need to be able to schedule backup
processes
Please keep in mind that when the user will install the software on his computer, he will not have sql server installed (I am saying this because I am under the impression that SMO requires sql server to be pre installed on the client machine).
Thank you
发布评论
评论(2)
您随时可以尝试 Google。
我假设您可以创建 Windows 窗体并连接
OnClick
事件,并对数据库运行SqlCommand
。然后,只需在用户按下适当的按钮时使用上面的文档编写适当的查询即可。顺便说一句:这是一个问答网站,而不是紧急咨询店。不要说“我没时间了”之类的话,也不要写下大量的需求清单并说告诉我如何做到这一点。这样你绝对不会得到任何帮助。在展示您的努力和具体技术问题后提出具体问题。
You could always try Google.
I'm assuming you can create Windows Forms and wire up
OnClick
events, and runSqlCommand
's against the database. Then it's just a matter of using the documentation above to write the appropriate queries when the user presses the appropriate button.BTW: This is a Q&A site, not an emergency consultant shop. Don't say things like "I'm running out of time" and don't write up large lists of requirements and say tell me how to do this. You'll get absolutely no help that way. Ask specific questions after demonstrating your effort and specific technical problem.
您可以查看此 C# 示例,了解如何使用 SMO 备份数据库
http://social.msdn.microsoft.com/forums/en-US/sqlexpress/thread/95750bdf-fcb1-45bf-9247-d7c0e1b9c8d2/
另一个选项是运行进程并从代码
http://www.sqldbatips.com/showarticle.asp?ID=27" 调用 sqlcmd ID=27
这是一些执行流程的示例代码
You could look at this C# example for using SMO to backup the database
http://social.msdn.microsoft.com/forums/en-US/sqlexpress/thread/95750bdf-fcb1-45bf-9247-d7c0e1b9c8d2/
The other option is to run a process and call sqlcmd from code
http://www.sqldbatips.com/showarticle.asp?ID=27
Here is some sample code to execute process