Adapter Method Freezing Application

I’ve got a button, that when clicked, is supposed to populate an EpiUltraGrid with sales order information.
I have it call the method below.
When it’s clicked, however, I get the hamster wheel and it locks up the entire application.
I copied a snippet of code that I used successfully in the past. Where did I go wrong?
Here’s the method that’s called when the button is clicked.

private void CallSalesOrderAdapterGetByIDMethod()
		EpiUltraGrid orders = (EpiUltraGrid)csm.GetNativeControlReference("ec24b85f-42b2-44e2-b5f1-9a03e1df78c3");
		// Declare and Initialize EpiDataView Variables
		EpiDataView edvOrderHed = ((EpiDataView)(this.oTrans.EpiDataViews["OrderHed"]));

		// Check if valid EpiDataView Row(s) are selected
		if ((edvOrderHed.Row < 0))

		// Declare and create an instance of the Adapter.
		SalesOrderAdapter adapterSalesOrder = new SalesOrderAdapter(this.oTrans);

		// Declare and Initialize Variables
		string stringID = ((edvOrderHed.dataView[edvOrderHed.Row]["OrderNum"]).ToString());

		// Call Adapter method
		Ice.Lib.Searches.SearchOptions opts = new SearchOptions(SearchMode.AutoSearch);
		bool morePages;
		string whereCls = "InstallOrderInt_c=" + stringID;
		System.Data.DataSet dsLinkedOrders = adapterSalesOrder.GetRows(opts, out morePages);
		orders.DataSource = dsLinkedOrders;

		// Cleanup Adapter Reference

	} catch (System.Exception ex)

I got it with the help of this post: Is it my code or the Adapter failing here? - #10 by josecgomez - ERP 10 - Epicor User Help Forum
Apparently opts.NamedSearch.WhereClauses.Add(“LinkedOrders”,whereCls); should have been “OrderHed” as that’s a hash key and not the name of the search like I thought it was.
Thanks @josecgomez!

1 Like