I'm write this code for run the sql server script on the c#:
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!!!");
but when i run the application i get this error:
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