Loading Combo from XSD

Discussion in 'ASP .Net Datagrid Control' started by Yama, Aug 9, 2004.

  1. Yama

    Yama Guest

    Hi,

    I have created a dataset (xsd) to pull data from two tables from a stored
    procedure.

    Step 1:
    CREATE PROCEDURE getComboBoxItems AS
    SELECT ID, Description FROM EmployeeStatus
    SELECT ID, Description FROM EmployeeType

    Step 2:
    I created a new XSD file. I draged the stored procedure which automatically
    created the tables.

    Step 3:
    public dsComboBoxItems GetComboBoxItems()
    {
    DataAccess.dsComboBoxItems ds = new DataAccess.dsComboBoxItems();
    try
    {
    SqlDataAdapter da = new
    SqlDataAdapter("GetComboBoxItems",sqlConnection);
    da.SelectCommand.CommandType = CommandType.StoredProcedure;

    // Create table mappings
    da.TableMappings.Add("Table", "EmployeeStatus");
    da.TableMappings.Add("Table1", "EmployeeType");
    // Fill the dataset
    da.Fill(ds);
    }
    catch (Exception ex){}

    return ds;
    }



    I would like to like to populate two combo boxes. How can I do this? I
    tried:

    cboEmployeeType.Items.Clear();
    dsEmployeeType = DAC.GetComboBoxItems();

    cboEmployeeType.DataSource = cboEmployeeType.Tables["EmployeeType"];
    cboEmployeeType.DataTextField =
    cboEmployeeType.Tables["EmployeeType"].Columns["Description "].ToString();
    cboEmployeeType.DataValueField =
    cboEmployeeType.Tables["EmployeeType"].Columns["ID"].ToString();
    cboEmployeeType.DataBind();

    Similarly I do the same with the EmployeeStatus combobox (dropdown box).

    Alas I am getting no returned value data from the database although I have
    many records in them.
    What do I ned to do to fill the comboboxes?

    Thanks,


    Yama
    Yama, Aug 9, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Markus
    Replies:
    1
    Views:
    1,081
    Markus
    Nov 22, 2005
  2. Rick Razzano

    XSD document for XSD defintion

    Rick Razzano, Sep 26, 2003, in forum: XML
    Replies:
    1
    Views:
    470
    C. M. Sperberg-McQueen
    Sep 26, 2003
  3. Hero41Day

    Loading Combo's (dropdownlist) and java script

    Hero41Day, May 12, 2006, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    89
    Hero41Day
    May 12, 2006
  4. dthmtlgod

    Fill Combo Box based on another Combo Box

    dthmtlgod, Nov 16, 2005, in forum: ASP General
    Replies:
    1
    Views:
    570
    Bob Barrows [MVP]
    Nov 16, 2005
  5. SM
    Replies:
    2
    Views:
    356
Loading...

Share This Page