Click here to Skip to main content
14,982,731 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi, this is Nachiketh,I ve a bug can please any one help......

i want to know how to display different values of one value from database in different labels

select name from emp where email='a2x.com'...

i want name column values to be displayed in different labels .....please anyone help
Posted
Comments
[no name] 11-Dec-11 14:05pm
   
Where is the problem to bind different labels to one column?

Hi how about
Label1.Text= Select name from emp where email='a2x.com'...;
Label2.Text=Label1.Text;
   
Hi,

you need to iterate through return value of your query.

with every result you can assign value to label text property.

if you have dataset fill-up with data then code may be
C#
foreach(DataRow drow in dset.Tables[0])
{
Label lb = new Label();
lb.Text = drow["name"].ToString();
//Code to add your newly created label in your page / panel.
}


hope this will help you,

thanks
-amit.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900