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.