private void button1_Click(object sender, EventArgs e)
{
//MessageBox.Show("1");
string connStr = "Data Source=zhang-PC;Initial Catalog=ManageSystem;Integrated Security = True";
//MessageBox.Show("2");
string sql_1 = "insert into PlayerInfo values('" + this.textBox1.Text + "','" + this.textBox2.Text + "','" + this.comboBox1.Text + "','" + this.comboBox2.Text + "')";
//MessageBox.Show("3");
string sql_2 = "insert into SelectSubject(player_id,subject_name) values('" + this.textBox1.Text + "','" + this.comboBox3.Text + "')"; SqlConnection conn = new SqlConnection(connStr);
//MessageBox.Show("4");
SqlCommand cmd1 = new SqlCommand(sql_1, conn);
SqlCommand cmd2 = new SqlCommand(sql_2, conn);
//MessageBox.Show("5");
//cmd1.ExecuteNonQuery();
//cmd2.ExecuteNonQuery(); //MessageBox.Show(err.Message);
MessageBox.Show("注册成功!");
conn.Close();
}当输入一组数据后,数据库里会出来差不多有20几行相同的数据。为什么啊?
解决方案 »
- 怎么让委托不被回收?
- C#Winform程序,怎样实现这种表格?
- winform treeview checkbox 权限树
- datagird怎么+超链接呀?
- c# 判断html中tr的classname属性等于某值的行是否存在 怎么写?
- 关于FileStream.Read的简单问题。
- 求C#.NET 中常用控件精典使用方法及实例下载~~
- wpf mvvm 模式的datagrid控件模板列的列头里的checkbox怎么在viewmodel里撤销勾选状态
- 恳请指教:帮忙写一个修改DataTable列名的类
- 新手入门紧急求助:如何判断一个字符串是不是IP地址?
- C# 如何获得AD域的用户密码策略?
- 正则表达式一问
SqlCommand cmd1 = new SqlCommand(sql_1, conn);
SqlCommand cmd2 = new SqlCommand(sql_2, conn);好像不能同时执行