an exception occurred while executing a transact-sql statement or batch
string sqlConnectionString = BuildeConnectionString(); FileInfo file = new FileInfo(Application.StartupPath + @"\DBScript\Database_generate.sql"); string script = file.OpenText().ReadToEnd(); SqlConnection conn = new SqlConnection(sqlConnectionString); Server server = new Server(new ServerConnection(conn)); server.ConnectionContext.ExecuteNonQuery(script ); file.OpenText().Close();
cmd.Connection = conn; cmd.CommandText = script cmd.CommandTimeout = 15; cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)