数据库的插入总是出错!
SqlConnection sqlConnection1 =
new SqlConnection("Data Source=YJY3;Initial Catalog=dflicapp;Integrated Security=True");
try
{
SqlCommand cmd = new SqlCommand();
cmd.CommandType = System.Data.CommandType.Text;
cmd.CommandText =
"update dfapp2007" +
" set shgsrs ='" + shgsrs.Text + "'" +
" shqsl = '" + shqsl.Text + "'" ;// 怎么总是在这里报错!
cmd.Connection = sqlConnection1;
sqlConnection1.Open();
cmd.ExecuteNonQuery();
result2.Visible = true;
}
catch (SqlException ex)
{
Response.Write(ex.Number);
Response.Write(ex.Message);
Response.Write(ex.StackTrace);
}
finally
{
sqlConnection1.Close();
}