T
tshad
How does the CommandBehavior.CloseConnection work?
I assumed that it is saying when you are done reading all the data, it will
close the connection automatically.
I have it set on one of my SP querys, which does 3 selects - so there are 3
result sets sent back.
In my Database object I do a:
returnReader = command.ExecuteReader( _
CommandBehavior.CloseConnection)
But when I try to read the data and bind them to the dropdownlists, I get
the following error after I have done a bind to the 1st dropdown and am
doing a NextResult() to point to the next set:
**************************************************
Invalid attempt to NextResult when reader is closed.
dbReader.NextResult()
*************************************************
I am doing the following (where the RunProcedure sets up and executes the
reader):
dbReader = myDbObject.RunProcedure("GetPositionDrops1", parameters)
Positions.DataSource = dbReader
Positions.DataValueField = "PositionID"
Positions.DataTextField = "JobTitle"
Positions.DataBind()
Positions.Items.Insert(0, new ListItem("Select from Active & Expired
Jobs",""))
dbReader.NextResult()
JobCategory.DataSource = dbReader
JobCategory.DataValueField = "CategoryCode"
JobCategory.DataTextField = "Category"
JobCategory.DataBind()
Why is the reader getting closed?
Thanks,
Tom
I assumed that it is saying when you are done reading all the data, it will
close the connection automatically.
I have it set on one of my SP querys, which does 3 selects - so there are 3
result sets sent back.
In my Database object I do a:
returnReader = command.ExecuteReader( _
CommandBehavior.CloseConnection)
But when I try to read the data and bind them to the dropdownlists, I get
the following error after I have done a bind to the 1st dropdown and am
doing a NextResult() to point to the next set:
**************************************************
Invalid attempt to NextResult when reader is closed.
dbReader.NextResult()
*************************************************
I am doing the following (where the RunProcedure sets up and executes the
reader):
dbReader = myDbObject.RunProcedure("GetPositionDrops1", parameters)
Positions.DataSource = dbReader
Positions.DataValueField = "PositionID"
Positions.DataTextField = "JobTitle"
Positions.DataBind()
Positions.Items.Insert(0, new ListItem("Select from Active & Expired
Jobs",""))
dbReader.NextResult()
JobCategory.DataSource = dbReader
JobCategory.DataValueField = "CategoryCode"
JobCategory.DataTextField = "Category"
JobCategory.DataBind()
Why is the reader getting closed?
Thanks,
Tom