コード例 #1
0
        public void Delete()
        {
            MySqlConnection conn = DB.Connection();

            conn.Open();

            var cmd = conn.CreateCommand() as MySqlCommand;

            cmd.CommandText = @"DELETE FROM message WHERE id = @thisId;";

            MySqlParameter idParameter = new MySqlParameter();

            idParameter.ParameterName = "@thisId";
            idParameter.Value         = _id;
            cmd.Parameters.Add(idParameter);

            cmd.ExecuteNonQuery();

            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }