简体   繁体   English

c#从ms sql数据库创建.bacpac文件

[英]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.

相关问题 您能否从远程C#应用程序创建SQL Azure BACPAC - Can you create a SQL Azure BACPAC from a Remote C# Application 将blob(.bacpac)转换为.bacpac文件以将数据库导入SQL Server Azure? - converting a blob (.bacpac) to .bacpac file to import database to SQL Server Azure? 是否可以使用C#代码将文件.sql(我使用MSSQL SERVER 2008 R2)转换为.bacpac? - Is it possible convert file .sql (I use MSSQL SERVER 2008 R2) to .bacpac with C# code? 如何从C#和SQL创建受用户名和密码保护的MS Access 2007文件? - How can I create user name and password protected MS Access 2007 file from C# and SQL? 从 C# 以编程方式还原 ms-sql 系统数据库 - Programmatically restoring ms-sql system database from C# 将Azure Blob容器中的file.bacpac导入Azure SQL数据库 - Import file.bacpac in Azure blob container to Azure SQL database C# 应用程序到 MS SQL 数据库调用堆栈 - C# application to MS SQL database callstack 从 C# SQL 创建 Excel 文件 - Create Excel file from C# SQL 在 Visual Studio 2015 中使用 SQL 服务器数据库从 C# 项目创建安装文件 - Create setup file from C# project with SQL server database in Visual Studio 2015 使用远程SQL Server上的C#从备份文件创建数据库 - Create database from backup file using C# on the remote SQL Server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM