static void Main() { SqlDBCon sqlDBCon = new SqlDBCon(); sqlDBCon.CheckSQlCon(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new GunRUsForm()); }
/// <summary> /// Deletes one row from a database table - by object name(string) /// </summary> /// <param name="rowName">Selected category to delete</param> /// <param name="tableName">Objective teble</param> public static void DeleteFromTable(string rowName, string tableName) { SqlDBCon sqlDB = new SqlDBCon(); using (SqlConnection connection = new SqlConnection(sqlDB.ConnectionString)) { using (SqlCommand command = new SqlCommand("DELETE from " + tableName + " where Name = '" + rowName + "'", connection)) { connection.Open(); command.ExecuteNonQuery(); } connection.Close(); } }