语句如下:
string ttime=this.txtTime.Text;
DateTime dtime=Convert.ToDateTime(ttime.ToString());
string tcard=this.txtCard.Text;
string tprice=this.txtPrice.Text.ToString();
double tmoney=Convert.ToDouble(tprice);
string ttype=this.txtType.Text;
string addword="insert into Trade(TradeDate,CardID,TradeMoney,TradeType) values('"+dtime+"','"+tcard+"','"+tmoney+"','"+ttype+"')";
Sconn=new SqlConnection(strcon);
Scomm=new SqlCommand(strcon,Sconn);
try
{
Sconn.Open();
Scomm=new SqlCommand(addword,Sconn);
Scomm.ExecuteNonQuery();
MessageBox.Show("添加成功啦!","添加成功",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
catch(SqlException ex)
{
MessageBox.Show(ex.Message);
}
。。忘了语句~sorry~!
string ttime=this.txtTime.Text;
DateTime dtime=Convert.ToDateTime(ttime.ToString());
string tcard=this.txtCard.Text;
string tprice=this.txtPrice.Text.ToString();
double tmoney=Convert.ToDouble(tprice);
string ttype=this.txtType.Text;
string addword="insert into Trade(TradeDate,CardID,TradeMoney,TradeType) values('"+dtime+"','"+tcard+"','"+tmoney+"','"+ttype+"')";
Sconn=new SqlConnection(strcon);
Scomm=new SqlCommand(strcon,Sconn);
try
{
Sconn.Open();
Scomm=new SqlCommand(addword,Sconn);
Scomm.ExecuteNonQuery();
MessageBox.Show("添加成功啦!","添加成功",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
catch(SqlException ex)
{
MessageBox.Show(ex.Message);
}
。。忘了语句~sorry~!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货