command.ExecuteReader(CommandBehavior.CloseConnection))是什么意思了?
public override ProductPropertyCollection GetProductPropertySet(string sql, int pageIndex, int pageSize, bool includePageIndex, bool returnFullThread){
using (SqlConnection myConnection = new SqlConnection(this.connectionString))
{
using (SqlCommand command = new SqlCommand("dbo.[RS_Get_ProductPropertySet]", myConnection))
{
= CommandType.StoredProcedure;
command.Parameters.Add("@PageIndex", SqlDbType.Int, 4).Value = pageIndex;
command.Parameters.Add("@PageSize", SqlDbType.Int, 4).Value = pageSize;
command.Parameters.Add("@sqlPopulate", SqlDbType.NText).Value = sql;
command.Parameters.Add("@IncludePageIndex", SqlDbType.Bit).Value = includePageIndex;
command.Parameters.Add("@ReturnFullThread", SqlDbType.Bit).Value = returnFullThread;
command.Parameters.Add("@TotalRecords", SqlDbType.Int).Direction = ParameterDirection.Output;
ProductPropertyCollection productpropertySet = new ProductPropertyCollection();
// Execute the command
myConnection.Open();
using (SqlDataReader dr = command.ExecuteReader(CommandBehavior.CloseConnection))
{
while (dr.Read())
{
productpropertySet.Add(PopulateProductPropertyEntryFromIDataReader(dr));
}
if (includePageIndex)
{
dr.NextResult();
while (dr.Read())
productpropertySet.PageIndex.Add(dr[0], dr[1]);
}
dr.Close();
myConnection.Close();
productpropertySet.TotalRecords = (int)command.Parameters["@TotalRecords"].Value;
}
return productpropertySet;
}
}
}
SqlDataReader dr = command.ExecuteReader(CommandBehavior.CloseConnection))
CommandBehavior.CloseConnection 这个找不到哪里定义的? 高手帮忙解答下了? 谢谢!