如何使用C#Windows应用程序还原数据库?我正在使用sqlYogEnterprise作为数据库 [英] How to restore database using c# windows application? I am using sqlYogEnterprise as database
本文介绍了如何使用C#Windows应用程序还原数据库?我正在使用sqlYogEnterprise作为数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用C#Windows应用程序还原数据库?我将sqlYogEnterprise用作数据库
How to restore database using c# windows application? I am using sqlYogEnterprise as database
推荐答案
除此之外,如果需要,还可以使用SMO.
使用:
http://msdn.microsoft.com/en-us/library/ms162133.aspx [ ^ ]
干杯.
:thumbsup:
Other than this, you can also use SMO if you want to.
Use :
http://msdn.microsoft.com/en-us/library/ms162133.aspx[^]
Cheers.
:thumbsup:
using system.data.sqlclient;
private string strquery;
sqlconnection con=new sqlconnection("database=master;server=urservername;uid=sa;pwd=''");
strquery="RESTORE DATABASE sqlYogEnterprise FROM DISK = 'D:\\sqlYogEnterprise.bak',";
strquery+=" WITH MOVE 'sqlYogEnterprise ' TO 'D:\\sqlYogEnterprise.mdf',";
strquery+=" MOVE 'sqlYogEnterprise_log' TO 'D:\\sqlYogEnterprises_log.ldf'";
sqlcommand cmd=new sqlcommand(strquery,con);
con.open();
cmd.executenonquery();
con.close();
这篇关于如何使用C#Windows应用程序还原数据库?我正在使用sqlYogEnterprise作为数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文