Results 1 to 4 of 4

Thread: [2.0] How to presents data from the database in textbox?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2007
    Posts
    240

    [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!!!

  2. #2
    Hyperactive Member
    Join Date
    Mar 2006
    Location
    Madrid
    Posts
    325

    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()

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2007
    Posts
    240

    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

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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
  •  



Click Here to Expand Forum to Full Width