UltraCombo sort in method?

I searched for a solution but found varied incomplete answers, so sorry if this was somewhere blatantly obvious.

I’m populating a dropdown with employees and displaying the employee name but storing the employee id. The data is coming back not sorted by the visible name and likely by the ID. Is there a way to sort the data directly in the method call? I’ve used the whereClause to filter my results, hoping there’s a quick way of adding the sort there as well.

Call is below.

private void SearchOnPREmployeeAdapterFillDropDown()
{
	bool recSelected;
	string whereClause = string.Empty;
	whereClause = String.Format("ExpenseCode = '1400'");
	System.Data.DataSet dsPREmployeeAdapter = Ice.UI.FormFunctions.SearchFunctions.listLookup(this.oTrans, "PREmployeeAdapter", out recSelected, false, whereClause);
	if (recSelected)
	{
		// Set EpiUltraCombo Properties
		this.epiUltraComboC1.ValueMember = "EmpID";
		this.epiUltraComboC1.DataSource = dsPREmployeeAdapter;
		this.epiUltraComboC1.DisplayMember = "Name";
		string[] fields = new string[] {
				"Name"};
		this.epiUltraComboC1.SetColumnFilter(fields);
	}
}

can you add the sort to the where clause?
whereClause = String.Format(“ExpenseCode = ‘1400’ ORDER BY Name”);

1 Like

No, throws an error. I tried that initially hoping it would be that easy.

Error is:
Incorrect syntax near the keyword ‘ORDER’.

How about BY Name – without ORDER

LOL, yes that does in fact work. With my SQL thinking I don’t know that I would have considered that, much thanks.