从网上搜说是sql语句有错误,但是感觉应该没有错误

           代码如下
           protected void Button1_Click(object sender, EventArgs e)
   {
       SqlConnection cn = new SqlConnection();
       cn.ConnectionString = ConfigurationManager.ConnectionStrings["connectname"].ConnectionString;
       cn.Open();
       SqlCommand cm = new SqlCommand("insert into student(id,name,num,time,ctime) values('" + this.TextBox1.Text+ "', '" + this.TextBox2.Text + "', '" + this.TextBox3.Text + "', '" + this.TextBox4.Text + "', '" + this.TextBox5.Text+"'",cn);
       cm.ExecuteNonQuery();//这个地方报错
       cn.Close();

求大神解救!!!!


  • Willson1991    2019-06-10 09:45:06
  • 阅读 737    收藏 0    回答 1
  • 邀请
  • 收藏
  • 分享
发送
登录 后发表评论
  • 51testing软件测试圈微信