qq_31247931
风雨悠扬
2015-09-15 14:09

C#向SQLServer数据库中插入数据,没有反应

  • server
  • 数据
  • 数据库
  • sql

C#向SQLServer数据库中插入数据,没有反应,代码如下:

  string conn, sql, strxm,strxh,strxb,strlxfs;
            strxm = textBox1.Text;
            strxh = textBox2.Text;
            strxb = textBox3.Text;
            strlxfs = textBox4.Text;
            conn = "Server=.;Database=13rj;Trusted_Connection=SSPI";
            //conn = "Server=(local);Database=13rj;uid=sa;pwd=59634";
            sql = "insert into rj13_basic(xm,xh,xb,lxfs) values("+ strxm + "," + strxh +","+strxb+","+strlxfs+")";
            SqlConnection myconn = new SqlConnection(conn);
            myconn.Open();
            SqlDataAdapter myda = new SqlDataAdapter(sql, conn);

            //DataSet myds = new DataSet();
            //myda.Fill(myds, "rj13_basic");

            myconn.Close();
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

6条回答