VS2013向微软SQL表添加数据
stringstrConn="Server=LENOVO-PC;database=worker;integratedsecurity=true";SqlConnectio...
string strConn = "Server=LENOVO-PC;database=worker;integrated security=true";
SqlConnection conn = new SqlConnection(strConn);
conn.Open();
string sql = @"insert into workinfo (id,name,departement,gender,job.birthday)values(" + textBox1.Text + ",'" + textBox2.Text + "'," + textBox3.Text + ",'" + textBox4.Text + "','" + textBox5.Text + "''"+textBox6.Text+"')";
SqlCommand cmd = new SqlCommand(sql, conn);
conn.Close();
Form1 frm1 = new Form1();
frm1.Show();
this.Hide();
请问为什么执行后数据库worker的workinfo表并没有新增内容啊? 展开
SqlConnection conn = new SqlConnection(strConn);
conn.Open();
string sql = @"insert into workinfo (id,name,departement,gender,job.birthday)values(" + textBox1.Text + ",'" + textBox2.Text + "'," + textBox3.Text + ",'" + textBox4.Text + "','" + textBox5.Text + "''"+textBox6.Text+"')";
SqlCommand cmd = new SqlCommand(sql, conn);
conn.Close();
Form1 frm1 = new Form1();
frm1.Show();
this.Hide();
请问为什么执行后数据库worker的workinfo表并没有新增内容啊? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询