예제 #1
0
 private void SendMsg()
 {
     if (textBox4.Text != "")
     {
         string time = CommonHandler.GetCurrentTime().ToString();
         Homepage.client.SendMsg(localUser, "text", textBox4.Text, remoteUser, time);
         textBox3.Text += localUser + ": " + time + "\r\n" + textBox4.Text + "\r\n";
         textBox4.Text  = "";
     }
     else
     {
         MessageBox.Show("Message can't be empty", "Warnning!");
     }
 }
예제 #2
0
        public static void InsertNews(string author, string content, string pictureStr)
        {
            conn.Open();
            SqlCommand insert = new SqlCommand("insert into user_news (author, content, date, title_picture) values(@AUT, @CONT, @DATE, @PIC)", conn);

            insert.Parameters.Add("@AUT", SqlDbType.VarChar).Value   = author;
            insert.Parameters.Add("@CONT", SqlDbType.VarChar).Value  = content;
            insert.Parameters.Add("@DATE", SqlDbType.DateTime).Value = CommonHandler.GetCurrentTime();
            insert.Parameters.Add("@PIC", SqlDbType.VarChar).Value   = pictureStr;

            insert.ExecuteNonQuery();

            insert.Dispose();
            conn.Close();
        }