Click here to Skip to main content
15,908,111 members
Please Sign up or sign in to vote.
4.00/5 (3 votes)
See more:
following is the code of my project...

please tell me how to get values from dataset and show to textboxes ,




C#
 SqlConnection cn = new SqlConnection("Data Source=SomePC\\SQLEXPRESS;Initial Catalog=SomeDB;Integrated Security=True;");

da = new SqlDataAdapter("select * from clubAC where accountno=" + txtacno .Text + "", cn);
ds = new DataSet();
cn.Open();
da.Fill(ds, "clubAC");


i want to show...
textbox1.text=..........value from dataset.
Posted
Updated 29-May-11 4:26am
v3

TextBox1.Text=ds.Tables[0].Rows[0][0].ToString();


Hope this can help you.
 
Share this answer
 
Comments
Kim Togo 29-May-11 13:28pm    
Good answer. My 5.
textbox1.text = Dataset.Tables[0].Rows[0][0].ToString();


For your information

Display Data from a Dataset in C# .NET[^]
 
Share this answer
 
Comments
Kim Togo 29-May-11 13:27pm    
Good answer. Simple and clean. My 5.
Espen Harlinn 29-May-11 14:37pm    
Agree, my 5 - a little help on your way to > 60K
thatraja 2-Jun-11 0:23am    
:blushing: No I want more. We must chase & cross SA & others :D
You cannot do that. You can take 1 column and show it under textbox1.Text.

If you want to show all values from all columns under your textbox1.Text, you have to concat all values to one string value.
 
Share this answer
 
v2

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