Example #1
0
        private void posting()
        {
            SessionDAO sess_dao  = new SessionDAO();
            string     content   = tb_post.Text;
            string     publisher = sess_dao.login_name();

            if (content.Trim() != string.Empty)
            {
                SqlConnection cn = new SqlConnection(constr);
                cn.Open();
                string     query = "insert into feeds(Publisher,Content, Time) values(@1,@2, @3)";
                SqlCommand cmd   = new SqlCommand(query, cn);
                cmd.Parameters.AddWithValue("@1", publisher);
                cmd.Parameters.AddWithValue("@2", content);
                cmd.Parameters.AddWithValue("@3", DateTime.Now);
                cmd.ExecuteNonQuery();
                cn.Close();
                tb_post.Text = "";
                tb_post.Focus();
            }
            load_feed();
        }