#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    2
    Rep Power
    0

    Question How to add values in a ComboBox from a Table


    I am trying to bound a combobox with a column of a table, i.e. all the values in that column must be loaded in the combobox. Can anyone help me out with this one?

    moreover, can I use more than one comboboxes to retrieve data from seperate tables. Like one combobox displays data from Table1.column1 and other from Table2.Column2 ??

    I am desperate. Thanks
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    India
    Posts
    4
    Rep Power
    0
    this.oleDbConn2 =new System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source="+((string)(configurationAppSettings.GetValue("DBPath", typeof(string)))));
    oleDbConn2.Open();
    string sqlSTR=string.Format("select column1 from table);
    this.oleDbComm2 =new System.Data.OleDb.OleDbCommand(sqlSTR,oleDbConn2);
    oleDbRead2=oleDbComm2.ExecuteReader();
    while (oleDbRead2.Read())
    {
    dropdownlost1.items.add(oleDbRead["column1"].toString());
    }
    oleDbRead2.Close();
    oleDbConn2.Close();

IMN logo majestic logo threadwatch logo seochat tools logo