我不知道似乎有什么问题,请尽可能帮忙,任何人都可以吗?
try
{
string Connectionstring = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True; User Instance=True";
SqlConnection cnn = new SqlConnection(Connectionstring);
cnn.Open();
SqlCommand cmd1 = new SqlCommand("insert into users values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "',' " + int.Parse(textBox5.Text) + " ')", cnn);
SqlDataReader dr1 = cmd1.ExecuteReader();
dr1.Close();
cmd1.ExecuteNonQuery();
int count = cmd1.ExecuteNonQuery();
if (count > 0)
MessageBox.Show(" Record inserted " + count );
cnn.Close();
}