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();