日期:2014-05-17  浏览次数:20868 次

保存 按钮的代码有什么问题???急
新建 按钮的代码如下:
private void button3_Click(object sender, EventArgs e)
  {
  textBox1.Text = "";
  textBox3.Text = "";
  textBox2.Text = "";
  textBox4.Text = "";
  textBox5.Text = "";
   
  }

保存 按钮的代码如下:
 private void button1_Click(object sender, EventArgs e)
  {
  string b1 = textBox1.Text.ToString();
  string b2 = textBox2.Text.ToString();
  string b3 = textBox3.Text.ToString();
  string b4 = textBox4.Text.ToString();
  string b5 = textBox5.Text.ToString();
  SqlConnection conn = new SqlConnection();
  SqlCommand cmd = new SqlCommand();
  conn = new SqlConnection("Data Source=.;Initial Catalog=基于责任中心的企业成本控制系统;Integrated Security=True");
  conn.Open();
  cmd = new SqlCommand("insert into 用户信息表 (用户编码,部门编号,用户名,密码,职务) values ('" + b1 + "','" + b2 + "','" + b3 + "','" + b4 + "','" + b5 + "')", conn);
  cmd.ExecuteNonQuery();
   

  conn.Close();

   

  }

请问有什么问题???谢谢!!!