예제 #1
0
        static void Main()
        {
            SqlDBCon sqlDBCon = new SqlDBCon();

            sqlDBCon.CheckSQlCon();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new GunRUsForm());
        }
예제 #2
0
        /// <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();
            }
        }