Figure 6 Loading the Categories
กก
// Get the categories via a DataReader
SqlCeCommand oCmd = new SqlCeCommand("SELECT CategoryID,    
    CategoryName FROM Categories " +
    " ORDER BY CategoryName", this.m_oCn);
this.m_oCn.Open();
SqlCeDataReader oDR = oCmd.ExecuteReader();

// Clear the category list and fill it
cboCategory.Items.Clear();
while (oDR.Read())
{
    cboCategory.Items.Add(new 
        Category((string)oDR["CategoryName"], 
        (int)oDR["CategoryID"]));
}
oDR.Close();
this.m_oCn.Close();

// Select the first category
cboCategory.SelectedIndex = 0;