473,396 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Assign result to variable

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
4 2052
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Mike | last post by:
Is there any way I can use a function to create a variable and assign a value to it? I have a Perl script that returns some LDAP information: sn=Shore givenname=Mike logintime=20041008153445Z...
25
by: Rim | last post by:
Hi, I have been thinking about how to overload the assign operation '='. In many cases, I wanted to provide users of my packages a natural interface to the extended built-in types I created for...
4
by: Eric | last post by:
How can I dynamically assign an event to an element? I have tried : (myelement is a text input) document.getElementById('myelement').onKeyUp = "myfnc(param1,param2,param3)"; ...
2
by: Matt | last post by:
If I assign Java variable a to javascript variable x, it is fine. <% int a = 10; %> var x = <%= a %>; alert(x); But if I do the other way around, then it has 500 error. any ideas??
16
by: sneill | last post by:
How is it possible to take the value of a variable (in this case, MODE_CREATE, MODE_UPDATE, etc) and use that as an object property name? In the following example I want 'oIcon' object to have...
0
by: trint | last post by:
How can I reach and execute a c# function from an actionscript in flash movie on my c# aspx dotNet webform? Ignacio Machin said I could do this: 1- You can access the page where the movie is...
6
by: david | last post by:
I try to use "for" loop to retrieve and assign values in web form. The code is in the following. But it can not be compiled. What I want to do is: txtQ1.Text =...
5
by: Orange | last post by:
hi, How to initialize the data variable. typedef struct { long len; BYTE data; }tag;
2
by: mguy27 | last post by:
I am working with VBA in ExcelUltimately I am trying to take a huge amount of data (9500-10000 rows) and do a search for text including the words "Violated Door". I then want to take the rows (which...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.