C# 添加信息出错 求解···
提示 :字符串')'有未闭合的引号 没找出啊 添加按钮事件try
{
SqlConnection thisConnection = new SqlConnection("server=localhost;uid=sa;pwd=sa;database=studentroom");
thisConnection.Open();
SqlCommand cmd = new SqlCommand("insert into droom (dno,dphone,dheader,dnumber) values('" + this.textBox1.Text + "','" + this.textBox2.Text + "','" + this.textBox3.Text + "'," + this.textBox4.Text + "')", thisConnection);
SqlDataReader myreader = cmd.ExecuteReader();
//this.Close();
thisConnection.Close();
MessageBox.Show("添加成功!", "提示");
}
catch (Exception err)
{
MessageBox.Show(err.Message); --------------------编程问答-------------------- this.Connection.Open();
使用ExecuteNonQuery()即可 --------------------编程问答-------------------- 还是有错啊 --------------------编程问答-------------------- thisConnection.Open();
SqlCommand cmd = new SqlCommand("insert into droom (dno,dphone,dheader,dnumber) values('" + this.textBox1.Text + "','" + this.textBox2.Text + "','" + this.textBox3.Text + "'," + this.textBox4.Text + "')", thisConnection);
SqlDataReader myreader = cmd.ExecuteReader();
//this.Close();
thisConnection.Close(); --------------------编程问答-------------------- 怎么不把提示错误的代码放出来看看的 --------------------编程问答-------------------- 不能插图啊
补充:.NET技术 , .NET Framework