|
-
May 4th, 2007, 03:12 AM
#1
Thread Starter
Addicted Member
[2.0] How to presents data from the database in textbox?
I have here a code for dropdownlist to present data from the database.
Code:
DataTable dtCountry = new DataTable();
daCountry.Fill(dtCountry);
countryList.DataSource = dtCountry;
countryList.DataTextField = "Country";
countryList.DataValueField = "CountryID";
string countryID = clusterList.SelectedValue;
What about the code for textBox? Many thanks!!!
-
May 4th, 2007, 09:31 AM
#2
Hyperactive Member
Re: [2.0] How to presents data from the database in textbox?
Hi,not sure whether this is what your´re looking for,
I haven´t tried it out either,..
Let´s say the text you are interested in is at row 3, column 3;
Code:
textbox.text = dtCountry .Rows[3][3].ToString()
-
May 7th, 2007, 02:48 AM
#3
Thread Starter
Addicted Member
Re: [2.0] How to presents data from the database in textbox?
I tried to used this code in order for me to view the current row in the database to a textbox.
Code:
lblSiteName.Text = dtSite.Rows.ToString();
But the output is:
System.Data.DataRowCollection
How can I fixed this thing? Thanks
-
May 7th, 2007, 05:44 AM
#4
Re: [2.0] How to presents data from the database in textbox?
Look at what he said:
Code:
dtCountry .Rows[3][3].ToString()
You need to specify a row number and a column number in the square brackets.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|