using (SqlConnection sqlConnection = new SqlConnection())
{
sqlConnection.ConnectionString = DB;
sqlConnection.Open();
SqlCommand SqlCommand = new SqlCommand(str, sqlConnection); return SqlCommand.ExecuteNonQuery();
}问题:难道用在using里面,不需要关闭数据库,它会自动关闭??
{
sqlConnection.ConnectionString = DB;
sqlConnection.Open();
SqlCommand SqlCommand = new SqlCommand(str, sqlConnection); return SqlCommand.ExecuteNonQuery();
}问题:难道用在using里面,不需要关闭数据库,它会自动关闭??
但是,你还是要手动的conn.close()
不然conn会占用内存的