【发布时间】:2015-08-05 06:25:38
【问题描述】:
我正在编写此代码以在 c# 上运行 sql server 脚本:
string sqlConnectionString = "Data Source=.;Initial Catalog=behzad;Integrated Security=True";
//string sqlConnectionString = "Data Source=(local);Initial Catalog=AdventureWorks;Integrated Security=True";
FileInfo file = new FileInfo("d:\\behzadBULK.sql");
string script = file.OpenText().ReadToEnd();
SqlConnection conn = new SqlConnection(sqlConnectionString);
Server server = new Server(new ServerConnection(conn));
server.ConnectionContext.ExecuteNonQuery(script);
MessageBox.Show("Insert!!!");
但是当我运行应用程序时出现此错误:
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.":null
【问题讨论】:
-
一一检查项目属性,确保每个项目都使用相同版本的 NET Framework。 (或者按照复制链接扫到地毯下)
标签: c# sql-server