码迷,mamicode.com
首页 > 其他好文 > 详细

添加代码

时间:2017-11-23 11:05:26      阅读:161      评论:0      收藏:0      [点我收藏+]

标签:end   dex   card   rgs   jin   car   price   sele   info   

string xinghao = this.txtxinghao.Text.Trim();
string chichun = this.txtchichun.Text.Trim();
string kuanshi = this.txtkuanshi.Text.Trim();
int jiage = Convert.ToInt32(this.txtjiage.Text.Trim());
int pinpai = Convert.ToInt32(this.cbopinpai.SelectedIndex);
int zhongliang = Convert.ToInt32(this.txtzhongliang.Text.Trim());
SqlConnection conn = new SqlConnection(DBHelpercs.CONNECTION_STRING);
conn.Open();
string sql = string.Format("INSERT INTO MobileInfo(BrandID,Type,price,size,Weight ,Style) VALUES (‘{0}‘,‘{1}‘,‘{2}‘,‘{3}‘,‘{4}‘,‘{5}‘)", pinpai, xinghao, jiage, chichun, zhongliang, kuanshi);
SqlCommand comd = new SqlCommand(sql, conn);
int count = Convert.ToInt32(comd.ExecuteNonQuery());
if (count > 0)
{
MessageBox.Show("添加成功!");
}
else
{
MessageBox.Show("添加失败!");
}
}


如果考到复选框的话
string a = "";
if (this.rbtnJinKa.Checked)
{
a = "金卡";
}
else if (this.rbtnBoJinKa.Checked)
{
a = "铂金卡";
}
else
{
a = "钻石卡";
}

更改选中卡别的时候
private void CardType_CheckedChanged(object sender, EventArgs e)
{
if (this.rbtnJinKa.Checked)
{
this.txtScore.Text = "500";
}
else if (this.rbtnBoJinKa.Checked)
{
this.txtScore.Text = "2000";
}
else
{
this.txtScore.Text = "5000";
}
}

添加代码

标签:end   dex   card   rgs   jin   car   price   sele   info   

原文地址:http://www.cnblogs.com/wangyuxin123/p/7883290.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!