Assign result to variable

  • Thread starter Thread starter Jim via DotNetMonster.com
  • Start date Start date
J

Jim via DotNetMonster.com

Hi,

How can I assign the result of a function to a variable. I need to get the
result so that I can query the database again.

What I'm trying is:
LessonID=GetPage(IntCourseNumber,IntLessonNumber,IntPageNumber)

I get the error:
Value of type 'System.Data.IDataReader' cannot be converted to 'Integer'

Thanks
 
Sorry but Just to clarify.

What I need to do within the script tag is assign one of the column results
to a variable. So normally I would do:

<ASP:Repeater id="RepeaterLessonNumber2" runat="server" DataSource="<%#
GetPage(IntCourseNumber,IntLessonNumber,IntPageNumber) %>">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "LessonID") %>
</ItemTemplate>
</ASP:Repeater>

How can I do this within the script?

Thanks
 
Can I return one of the rows in the datareader to a variable? If I can do
that then that would solve my problem.

I'm using 1 function called Getpages to get an ID from a Table depending on
a certain page. Then in my second function I'm trying to get the max page
number. So I need to retrieve that ID from the first function.

Can I do something like this within the first function:

Dim IntLessonID As System.Data.IDataReader
Return LessonID

This doesn't work because I need to get a specific column LessonID from the
dataReader but I'm not sure if I can do that?

Thanks
 
I figured it out. I can get the result of a column from the reader like you
suggested:

LessonID=dataReader("LessonID")

Thanks
 
Back
Top