T
tshad
I have a dataReader that I am trying to use with datalist that works fine
with my dropdown but gives me an error when binding with the datalist.
The error is:
Invalid attempt to FieldCount when reader is closed
The code is:
**********************************************************
Dim myDbObject as new DbObject()
Dim DBReader As SqlDataReader
Dim parameters As SqlParameter () = { _
New SqlParameter("@Email",SqlDbType.VarChar,45) }
parameters(0).value = session("Email")
dbReader = myDbObject.RunProcedure("GetLetters", parameters)
DataList1.DataSource=dbReader
DataList1.databind()
*************************************************************
The myDbObject.RunProcedure is my object that fills a datareader from the
Stored Procedure "GetLetters".
The dropdown list worked fine when I had:
StoredLetters.DataSource=dbReader
StoredLetters.DataValueField="LetterID"
StoredLetters.DataTextField= "LetterTitle"
StoredLetters.databind()
I just changed the datasource area and assumed this would work, but it
doesn't.
The datalist is:
<aspataList ID="DataList1" RepeatColumns="4"
RepeatDirection="Horizontal" runat="server" >
<ItemTemplate><%# Container.DataItem("LetterTitle") %>
</ItemTemplate>
</aspataList>
Very simple - I would have thought.
What would cause that problem?
It is virtually identical code, except for the dropdownlist vs the Datalist.
Thanks,
Tom
with my dropdown but gives me an error when binding with the datalist.
The error is:
Invalid attempt to FieldCount when reader is closed
The code is:
**********************************************************
Dim myDbObject as new DbObject()
Dim DBReader As SqlDataReader
Dim parameters As SqlParameter () = { _
New SqlParameter("@Email",SqlDbType.VarChar,45) }
parameters(0).value = session("Email")
dbReader = myDbObject.RunProcedure("GetLetters", parameters)
DataList1.DataSource=dbReader
DataList1.databind()
*************************************************************
The myDbObject.RunProcedure is my object that fills a datareader from the
Stored Procedure "GetLetters".
The dropdown list worked fine when I had:
StoredLetters.DataSource=dbReader
StoredLetters.DataValueField="LetterID"
StoredLetters.DataTextField= "LetterTitle"
StoredLetters.databind()
I just changed the datasource area and assumed this would work, but it
doesn't.
The datalist is:
<aspataList ID="DataList1" RepeatColumns="4"
RepeatDirection="Horizontal" runat="server" >
<ItemTemplate><%# Container.DataItem("LetterTitle") %>
</ItemTemplate>
</aspataList>
Very simple - I would have thought.
What would cause that problem?
It is virtually identical code, except for the dropdownlist vs the Datalist.
Thanks,
Tom