Exemple #1
0
        public static bool insertPost(post p)
        {
            MySqlConnection Connection = db.getcon();

            if (Connection != null)
            {
                MySqlCommand sql = new MySqlCommand();
                sql.CommandText = "insert_post";
                sql.CommandType = System.Data.CommandType.StoredProcedure;
                sql.Parameters.Add(new MySqlParameter("email", p.PosterMail));
                sql.Parameters.Add(new MySqlParameter("caption_", p.Caption));
                sql.Parameters.Add(new MySqlParameter("date_post", DateTime.Now));
                sql.Parameters.Add(new MySqlParameter("picture_id", p.ImagePath));
                sql.Parameters.Add(new MySqlParameter("is_public", p.IsPublic?"Y":"N"));
                sql.Connection = Connection;
                sql.ExecuteNonQuery();
                Connection.CloseAsync();
                return(true);
            }
            return(false);
        }