what am I doing wrong?

  • Thread starter Thread starter Joe777
  • Start date Start date
J

Joe777

Hi all,

I am attempting to return the number of returned rows in a table
within a dataset and display that on a label on my page. I figured
this would be a fairly easy process, but alas it seems I am missing
something.


This is in my Sub Page_Load after my db connection and dataset
creation, etc...:

mylabel.Text = ds.Tables(0).Rows.Count


My label in my html is this:

<asp:label ID ="mylabel" runat="server"/>

What am I missing?

cheers, Joe
 
You don't tell us what language you're working with, no specific error
messages you're getting, and not much else to go on - so a couple of shots
in the dark...

If you are coding with C#, then you'd need the following:
mylabel.Text = DS2.Tables[0].Rows.Count;
or
mylabel.Text = DS2.Tables[0].Rows.Count.ToString();

does your html include a <form> tag with runat="server"?
 
Yes it does include <form runat="server">

The error I am getting is not declared error on the label name.



Wang said:
You don't tell us what language you're working with, no specific error
messages you're getting, and not much else to go on - so a couple of shots
in the dark...

If you are coding with C#, then you'd need the following:
mylabel.Text = DS2.Tables[0].Rows.Count;
or
mylabel.Text = DS2.Tables[0].Rows.Count.ToString();

does your html include a <form> tag with runat="server"?



Joe777 said:
Hi all,

I am attempting to return the number of returned rows in a table
within a dataset and display that on a label on my page. I figured
this would be a fairly easy process, but alas it seems I am missing
something.


This is in my Sub Page_Load after my db connection and dataset
creation, etc...:

mylabel.Text = ds.Tables(0).Rows.Count


My label in my html is this:

<asp:label ID ="mylabel" runat="server"/>

What am I missing?

cheers, Joe
 
Back
Top