473,396 Members | 2,158 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.

display data in stored procedure from multiple tables in label con

I have a DBA that wrote a stored procedure that does a SELECT from a
particluar SQL Server table. Within that stored procedure he links over to
grab a column from another database table. I need to display this information
in 5 different label controls in an ASP.NET web page. When I test the stored
procedure in a GridView all the columns display correctly (I am not manually
defining the columns). When I try to use labels I can display all this
information fine with the exception of the column that he calls from the
separate table. I'm getting an "IndexOutOfRangeException- Make sure your
column names are correct". I've tried naming the column in my code the same
thing he uses in his stored procedure as well as the automatically generated
column name that I see in the GridView when I test it. Nothing seems to work.
Can someone help me with the correct syntax to call this column?

Here is the code snipet for rendering the labels in the ASP.NET page.
"uxMemberParticipation.Text += reader["Column1"].ToString();" is the line in
question that keeps erroring out.

while (reader.Read())
{
uxCertNumber.Text += reader["CertNbr"].ToString();
uxLastName.Text += reader["LName"].ToString();
uxFirstName.Text += reader["FName"].ToString();
uxStatusDate.Text += reader["StatusDate"].ToString();
uxMemberParticipation.Text += reader["Column1"].ToString();
}

My DBA's stored procedure snipet is below. The
dbo.MemberParticipation(CoverageCode) is where he is calling the other table.
I've tried every combination of that line in my label and nothing seems to
work:

BEGIN --Member Found
SELECT CertNbr, LName, FName, StatusDate,
dbo.MemberParticipation(CoverageCode)
FROM tbMember
WHERE MemberID = @sMemberIDAND DependentNbr = '00' AND
LName=@sLastName AND MemberStatus <>'T'
RETURN
END

I apologize for the long post but any help would be appreciated.
Apr 18 '06 #1
2 4449
I'd suggest changing the stored proc so that is allocates an alias to the
additional column. I suspect the column has no name.

You might also try referencing the column by ordinal, that is ,its column
number , reader[4].ToString();

--
#####-----#####-----#####
POV Tips and Hints at ...
http://povman.blogspot.com/
"Joe Campbell" <th****@community.nospam> wrote in message
news:87**********************************@microsof t.com...
I have a DBA that wrote a stored procedure that does a SELECT from a
particluar SQL Server table. Within that stored procedure he links over to
grab a column from another database table. I need to display this
information
in 5 different label controls in an ASP.NET web page. When I test the
stored
procedure in a GridView all the columns display correctly (I am not
manually
defining the columns). When I try to use labels I can display all this
information fine with the exception of the column that he calls from the
separate table. I'm getting an "IndexOutOfRangeException- Make sure your
column names are correct". I've tried naming the column in my code the
same
thing he uses in his stored procedure as well as the automatically
generated
column name that I see in the GridView when I test it. Nothing seems to
work.
Can someone help me with the correct syntax to call this column?

Here is the code snipet for rendering the labels in the ASP.NET page.
"uxMemberParticipation.Text += reader["Column1"].ToString();" is the line
in
question that keeps erroring out.

while (reader.Read())
{
uxCertNumber.Text += reader["CertNbr"].ToString();
uxLastName.Text += reader["LName"].ToString();
uxFirstName.Text += reader["FName"].ToString();
uxStatusDate.Text += reader["StatusDate"].ToString();
uxMemberParticipation.Text += reader["Column1"].ToString();
}

My DBA's stored procedure snipet is below. The
dbo.MemberParticipation(CoverageCode) is where he is calling the other
table.
I've tried every combination of that line in my label and nothing seems to
work:

BEGIN --Member Found
SELECT CertNbr, LName, FName, StatusDate,
dbo.MemberParticipation(CoverageCode)
FROM tbMember
WHERE MemberID = @sMemberIDAND DependentNbr = '00' AND
LName=@sLastName AND MemberStatus <>'T'
RETURN
END

I apologize for the long post but any help would be appreciated.

Apr 18 '06 #2
Hey Josh, using the ordinal did the trick. I appreciate your help!

"Josh" wrote:
I'd suggest changing the stored proc so that is allocates an alias to the
additional column. I suspect the column has no name.

You might also try referencing the column by ordinal, that is ,its column
number , reader[4].ToString();

--
#####-----#####-----#####
POV Tips and Hints at ...
http://povman.blogspot.com/
"Joe Campbell" <th****@community.nospam> wrote in message
news:87**********************************@microsof t.com...
I have a DBA that wrote a stored procedure that does a SELECT from a
particluar SQL Server table. Within that stored procedure he links over to
grab a column from another database table. I need to display this
information
in 5 different label controls in an ASP.NET web page. When I test the
stored
procedure in a GridView all the columns display correctly (I am not
manually
defining the columns). When I try to use labels I can display all this
information fine with the exception of the column that he calls from the
separate table. I'm getting an "IndexOutOfRangeException- Make sure your
column names are correct". I've tried naming the column in my code the
same
thing he uses in his stored procedure as well as the automatically
generated
column name that I see in the GridView when I test it. Nothing seems to
work.
Can someone help me with the correct syntax to call this column?

Here is the code snipet for rendering the labels in the ASP.NET page.
"uxMemberParticipation.Text += reader["Column1"].ToString();" is the line
in
question that keeps erroring out.

while (reader.Read())
{
uxCertNumber.Text += reader["CertNbr"].ToString();
uxLastName.Text += reader["LName"].ToString();
uxFirstName.Text += reader["FName"].ToString();
uxStatusDate.Text += reader["StatusDate"].ToString();
uxMemberParticipation.Text += reader["Column1"].ToString();
}

My DBA's stored procedure snipet is below. The
dbo.MemberParticipation(CoverageCode) is where he is calling the other
table.
I've tried every combination of that line in my label and nothing seems to
work:

BEGIN --Member Found
SELECT CertNbr, LName, FName, StatusDate,
dbo.MemberParticipation(CoverageCode)
FROM tbMember
WHERE MemberID = @sMemberIDAND DependentNbr = '00' AND
LName=@sLastName AND MemberStatus <>'T'
RETURN
END

I apologize for the long post but any help would be appreciated.


Apr 18 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: jamiemcc | last post by:
Hi, I would like to have 1 stored procedure call another stored procedure (which contains multiple select statements) and then be able to access the 3 result sets. Example Create Procedure ....
3
by: wxbuff | last post by:
I have a report based on our product names that consists of two parts. Both insert data into a temporary table. 1. A single grouped set of results based on all products 2. Multiple tables based...
2
by: James Foreman | last post by:
I'm building a stored procedure that simulates cars arriving in a car park, and staying for different amounts of time, based on historical data. So, first I define a cursor that's populated by...
1
by: Mike | last post by:
I need to enter data into multiple tables from the same field in one form. Is this possible? If so, how do I accomplish it. Example: I need to enter changes to a customer master table (name,...
2
by: Justin | last post by:
I am creating a web app for a client in VS.NET using ASP.NET with C#. I need to query three tables in a database using one parameter and display the results on the page. my question is should I use...
15
by: Steve | last post by:
I am trying to develop a stored procedure for an existing application that has data stored in numerous tables, each with the same set of columns. The main columns are Time and Value. There are...
4
by: Chris | last post by:
This might be a stupid question.... I have a stored procedures, which uses two selects. When I run the SP I get two resultsets, one very big and the other much smaller, which is the one I want in...
0
by: sachjn | last post by:
Hi, I have three tables with columns as: Person_sys1 Id(pk) name telephoneNum userid ----- -------- ---------------------- --------- Person_sys2 Id(pk) name ...
1
by: Zachary McCartt | last post by:
I have an Access DB and am trying to have a quiery tell me one value from a table based on its corresponding values equality to a field within the quiery. The Table and quiery have data as such ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.