Example #1
0
        public void MyWebsite(Models.Comment_model onNewComment)
        {
            SqlCommand com = new SqlCommand("Sp_AddComment", con);

            com.CommandType = CommandType.StoredProcedure;
            com.Parameters.AddWithValue("@Name", onNewComment.Name);
            com.Parameters.AddWithValue("@Email", onNewComment.Email);
            com.Parameters.AddWithValue("@Date", onNewComment.Date);
            com.Parameters.AddWithValue("@Message", onNewComment.Message);
            con.Open();
            com.ExecuteNonQuery();
            con.Close();
        }
Example #2
0
        public void Update_Comment(Models.Comment_model onNewComment)
        {
            SqlCommand com = new SqlCommand("Sp_UpdateComment", con);

            com.CommandType = CommandType.StoredProcedure;
            com.Parameters.AddWithValue("@CommentId", onNewComment.CommentId);
            com.Parameters.AddWithValue("@Name", onNewComment.Name);
            com.Parameters.AddWithValue("@Email", onNewComment.Email);

            com.Parameters.AddWithValue("@Comment", onNewComment.Message);
            con.Open();
            com.ExecuteNonQuery();
            con.Close();
        }