[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!!!
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()
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:
Quote:
System.Data.DataRowCollection
How can I fixed this thing? Thanks
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.