我正在尝试使用 Windows 窗体应用程序将记录添加到数据库。当我调试代码时,我得到一个异常:'value'附近的语法不正确对不起代码中的混乱,我是新成员。
private void button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=VirtualSalesFair;Integrated Security=True");
con.Open();
SqlCommand sc = new SqlCommand("Insert into Empty value('" + textBox1.Text + "'," + textBox2.Text + ",'" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "','" +textBox9.Text +"',"+textBox10.Text +");", con);
int o=sc.ExecuteNonQuery();
MessageBox.Show(o+ ":Record has been inserted");
con.Close();
}