SQL Server数据库任务,分离,备份和还原 [英] SQL Server DB tasks, Detach, Backup and Restore

查看:279
本文介绍了SQL Server数据库任务,分离,备份和还原的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在通过vb.net代码附加我的数据库.现在,我需要以下方面的帮助:

1)如何使用代码(uid = sa,pwd = abc123)分离它?
2)如何进行备份?
3)如何还原备份?

请注意,我想使用vb.net代码完成所有操作

非常感谢.

Hi,
I am attaching My DB through vb.net code. Now I request help for the following:

1) How to detach it using code (uid=sa, pwd=abc123)?
2) How to take backup?
3) How to restore backup?

Please note I want to do it all using vb.net code

Thanks a lot.

推荐答案

备份和还原程序

备份和使用VB.NET还原SQL Server数据库 [ 5:cmd.connection = conn
6:cmd.executenonquery


使用用户名和密码的连接字符串

数据源= SQLSERVERNAME;初始目录= master; uid = sa; pwd = sa;".

希望这会有所帮助,如果是,请接受并投票,否则将返回您的答案
--Rahul D.
backup and restore program

Backup & Restore of SQL Server database using VB.NET[^]


Attach and detach program



1: conn.connectionstring = ?
2: conn.open
3: cmd.CommandType = CommandType.StoredProcedure
4: cmd.CommandText = "sp_attach_db "lms'' "
5: cmd.connection=conn
6: cmd.executenonquery


connection string using username and pass

"Data Source=SQLSERVERNAME; INITIAL CATALOG=master; uid=sa; pwd=sa;".

Hope this helps if yes then accept and vote the answer otherwise revert back with your answer
--Rahul D.


这篇关于SQL Server数据库任务,分离,备份和还原的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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