日期:2014-05-17 浏览次数:20988 次
private void button_single_Click(object sender, EventArgs e) //个人短信----支持发送单个号码的短信 { label4.Text = "短信发送中..."; string telephone = textBox4.Text.Trim(); //获取电话号码 string message = textBox3.Text.Trim(); //获取短信内容 type = 1; if (CPPDLL.Sms_Send(telephone, message) == 1) //发短信过程,成功返回1,不成功返回0 { label4.Text = "发送成功"; in_history( System.DateTime.Now.ToString(), type, message, "" , telephone);//调用函数 } else { label4.Text = "发送失败"; } }
private void in_history(string time ,int type, string text, string name, string number)//将发送记录插入数据表 { string connString = MessageModem.Properties.Settings.Default.ConnString; SqlConnection sqlConnection = new SqlConnection(connString); sqlConnection.Open(); string newsql = string.Format("update t_history set time = time, type = type, text = text, name = name, number = number"); SqlCommand newcmd = new SqlCommand(newsql, sqlConnection); SqlDataAdapter newdata = new SqlDataAdapter(); newdata.UpdateCommand = newcmd; newcmd.ExecuteNonQuery(); }
string newsql = string.Format("update t_history set time = '{0}', type = '{1}', text = '{2}', name = '{3}', number = '{4}'",time,type,text,name,number);