Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Datagrid Control (http://www.velocityreviews.com/forums/f60-asp-net-datagrid-control.html)
-   -   Loading Combo from XSD (http://www.velocityreviews.com/forums/t760941-loading-combo-from-xsd.html)

Yama 08-09-2004 06:46 PM

Loading Combo from XSD
 
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




All times are GMT. The time now is 04:47 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.