473,799 Members | 2,927 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 "IndexOutOfRang eException- 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.
"uxMemberPartic ipation.Text += reader["Column1"].ToString();" is the line in
question that keeps erroring out.

while (reader.Read())
{
uxCertNumber.Te xt += reader["CertNbr"].ToString();
uxLastName.Text += reader["LName"].ToString();
uxFirstName.Tex t += reader["FName"].ToString();
uxStatusDate.Te xt += reader["StatusDate "].ToString();
uxMemberPartici pation.Text += reader["Column1"].ToString();
}

My DBA's stored procedure snipet is below. The
dbo.MemberParti cipation(Covera geCode) 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.MemberParti cipation(Covera geCode)
FROM tbMember
WHERE MemberID = @sMemberIDAND DependentNbr = '00' AND
LName=@sLastNam e AND MemberStatus <>'T'
RETURN
END

I apologize for the long post but any help would be appreciated.
Apr 18 '06 #1
2 4490
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****@communi ty.nospam> wrote in message
news:87******** *************** ***********@mic rosoft.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 "IndexOutOfRang eException- 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.
"uxMemberPartic ipation.Text += reader["Column1"].ToString();" is the line
in
question that keeps erroring out.

while (reader.Read())
{
uxCertNumber.Te xt += reader["CertNbr"].ToString();
uxLastName.Text += reader["LName"].ToString();
uxFirstName.Tex t += reader["FName"].ToString();
uxStatusDate.Te xt += reader["StatusDate "].ToString();
uxMemberPartici pation.Text += reader["Column1"].ToString();
}

My DBA's stored procedure snipet is below. The
dbo.MemberParti cipation(Covera geCode) 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.MemberParti cipation(Covera geCode)
FROM tbMember
WHERE MemberID = @sMemberIDAND DependentNbr = '00' AND
LName=@sLastNam e 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****@communi ty.nospam> wrote in message
news:87******** *************** ***********@mic rosoft.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 "IndexOutOfRang eException- 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.
"uxMemberPartic ipation.Text += reader["Column1"].ToString();" is the line
in
question that keeps erroring out.

while (reader.Read())
{
uxCertNumber.Te xt += reader["CertNbr"].ToString();
uxLastName.Text += reader["LName"].ToString();
uxFirstName.Tex t += reader["FName"].ToString();
uxStatusDate.Te xt += reader["StatusDate "].ToString();
uxMemberPartici pation.Text += reader["Column1"].ToString();
}

My DBA's stored procedure snipet is below. The
dbo.MemberParti cipation(Covera geCode) 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.MemberParti cipation(Covera geCode)
FROM tbMember
WHERE MemberID = @sMemberIDAND DependentNbr = '00' AND
LName=@sLastNam e 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
2118
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 . exec Multiple --manipulate result set A
3
2550
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 on individual product names. I am getting data by calling the same stored procedure multiple times... for the single set of data I use "product like '%'" To get the data for individual products, I am using a cursor to parse
2
1479
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 querying last year's bookings for the period that I'm interested in. This is about 6,500 bookings. The sp then looks at the first booking and compares it to how many cars are already in the car park. If adding that booking would violate the
1
3804
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, address, city, state, etc) but I need to have a historical table that keeps track of the past history of the account. So when I edit and update the customer master information, from a form, I want that record to be entered into the historical table,...
2
1850
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 a Stored Procedure or view in SQL Server to get the data from multiple tables? What is the difference? and where can I find a some articles on write code to display the results of the SP or view? Thanks, Justin.
15
22890
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 literally hundreds of these tables that are storing values at one minute intervals. I need to calculate the value at the end of the current hour for any table. I am a little new to SQL Server, but I have some experience with other RDBMS. I get an...
4
9141
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 the dataset. How do a ensure only the last one goes in the dataset.
0
949
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 telephoneNum userid
1
1267
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 Table Queiry Height Min Height Weight BFF 58 91 59 101 ??? 59 95 58 105 ??? 60 99 59 90 ???
0
9687
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10482
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9072
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.