[英]c# create a .bacpac file from ms sql database
I try to create a bacpac File from my complete Database. 我尝试从完整的数据库创建bacpac文件。
I added Microsoft.SqlServer.Dac.dll
and created a DacService
. 我添加了Microsoft.SqlServer.Dac.dll
并创建了一个DacService
。 And on the service I call the ExportBacpac
method. 在服务上,我调用ExportBacpac
方法。 But I always get the error that the Database Source is not supported Version of SQL Server. 但是我总是收到错误消息,即不支持数据库源版本的SQL Server。
Here is my code: 这是我的代码:
SqlConnectionStringBuilder csb = new SqlConnectionStringBuilder();
csb.DataSource = txtServerStart.Text;
csb.Password = txtPassword.Text;
csb.UserID = txtUserName.Text;
DacServices ds = new DacServices(csb.ConnectionString);
ds.ExportBacpac(@"C:\backup\backup.bacpac" + txtFilename.Text, cbDatabase.SelectedItem.ToString());
The error comes on the line where I call the ExportBacpac
method. 错误出现在我调用ExportBacpac
方法的行上。
the problem was i am using MS SQL Server 2016 and the Version of the Dac DLL´s was to old. 问题是我使用的是MS SQL Server 2016,Dac DLL的版本太旧了。 i used 12.xxxxx but i need 13.xxxxxx 我用12.xxxxx但我需要13.xxxxxx
After i referenced these DLL's it works fine 在我引用这些DLL之后,它可以正常工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.