what am I doing wrong?

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
 
W

Wang

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"?
 
J

Joe Van Meer

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top