开发者

SMO not available in .NET 4.0? Or is there an easier way to backup a database from code

开发者 https://www.devze.com 2023-01-14 15:12 出处:网络
We upgraded our application to .NET 4.0 a while ago, and now need to add the ability to backup SQL Server 2008 databases from the app.However, it doesn\'t seem that SMO is available for .NET 4.Is ther

We upgraded our application to .NET 4.0 a while ago, and now need to add the ability to backup SQL Server 2008 databases from the app. However, it doesn't seem that SMO is available for .NET 4. Is there a workaround or 开发者_开发百科better way to perform a database backup (note that our backups need to be user initiated over a website, so we cannot schedule them).


Use BACKUP DATABASE?

Otherwise, try these One, Two


You can still reference SMO from a .NET 4.0 application, even with it targeting the .NET 2.0 framework.

If you get the Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information. exception, installing the latest version of the SQL Server SDK (SQL Server 2008 R2) should fix it, even if the machine is running an older version of SQL Server e.g. 2005.

0

精彩评论

暂无评论...
验证码 换一张
取 消