所以我有一个 C# 软件,可以将数据保存到我的数据库中,但是每次我运行我的程序并尝试保存数据时,我都会收到此消息,请帮忙?
try
{
SqlConnection cnn = new SqlConnection(@"Data Source=.\SQLEXPRESS;
AttachDbFilename=C:\Users\Hp\Documents\Visual Studio 2010\Projects\Bank_System\Bank_System\Bank_System.sdf;
Integrated Security=True;User Instance=True");
cnn.Open();
SqlCommand cmd1 =
new SqlCommand("insert into user values('" +
textBox6.Text + "','" + textBox1.Text + "','" + textBox4.Text + "'," +
textBox3.Text + ",'" + textBox2.Text + "','" + textBox5.Text + "')",
cnn);
SqlDataReader dr1 = cmd1.ExecuteReader();
dr1.Close();
MessageBox.Show(" Record inserted ", " information inserted");
cnn.Close();
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message);
}