public void CreateStoredProcedures() { var provider = new SqlServer.SqlConnectionProvider(); Trace.Write("Loaded provider " + provider.GetType().Name); using (var cn = new SqlConnection(Properties.Settings.Default.ConnectionString)) { cn.Open(); using (var cmd = cn.CreateCommand()) { foreach (var sql in Regex.Split(Properties.Resources.DatabaseReset, @"^\s*GO\s*$", RegexOptions.Multiline)) { cmd.CommandText = sql; cmd.ExecuteNonQuery(); } } } }
public void CreateStoredProcedures() { var provider = new SqlServer.SqlConnectionProvider(); Trace.Write("Loaded provider " + provider.GetType().Name); using (var cn = new SqlConnection(DatabaseHelper.ConnectionString)) { cn.Open(); using (var cmd = cn.CreateCommand()) { foreach (var sql in Regex.Split(Properties.Resources.DatabaseReset, @"^\s*GO\s*$", RegexOptions.Multiline)) { cmd.CommandText = sql; cmd.ExecuteNonQuery(); } } } }
public static void Reset() { try { var provider = new SqlServer.SqlConnectionProvider(); using (var cn = new SqlConnection(ConnectionString)) { cn.Open(); using (var cmd = cn.CreateCommand()) { cmd.CommandText = "TestReset"; cmd.CommandType = CommandType.StoredProcedure; cmd.ExecuteNonQuery(); } } } catch (Exception ex) { Trace.WriteLine(ex.ToString()); throw; } }