//Execute Script to Sql Server public static void ExecuteScript() { if (File.Exists(path)) { string script = GetScript(); var splitter = new[] { "\r\nGO\r\n" }; string[] commandTexts = script.Split(splitter, StringSplitOptions.RemoveEmptyEntries); foreach (string commandText in commandTexts) { using (var ctx = new ClassSRMDataContext(Config.connection)) { if (!string.IsNullOrEmpty(commandText)) { ctx.ExecuteCommand(commandText); } } } } }