By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,290 Members | 1,631 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,290 IT Pros & Developers. It's quick & easy.

Assign result to variable

P: n/a
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,I ntPageNumber)

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

Thanks

--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Where is "GetPage()" defined? change it's return type, or run a
Convert.To???()
--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Jim via DotNetMonster.com" <fo***@DotNetMonster.com> wrote in message
news:c7******************************@DotNetMonste r.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,I ntPageNumber)

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

Thanks

--
Message posted via http://www.dotnetmonster.com

Nov 19 '05 #2

P: n/a
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,IntPageNum ber) %>">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "LessonID") %>
</ItemTemplate>
</ASP:Repeater>

How can I do this within the script?

Thanks

--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #3

P: n/a
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

--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #4

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

LessonID=dataReader("LessonID")

Thanks

--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.