I never used NamedSearch, did you mean to make a RuntimeSearch?
// create Hashtable of tableName
System.Collections.Hashtable myHash = new System.Collections.Hashtable();
string wClause = "Key1 = '" + key1 + "'";
// add table name (key) and where clause to Hashtable
myHash.Add("UD100A", wClause);
// Create SearchOptions object
SearchOptions opts = Ice.Lib.Searches.SearchOptions.CreateRuntimeSearch(myHash, DataSetMode.RowsDataSet);
// Call Adapter InvokeSearch()
ud100Adapter.InvokeSearch(opts);
Im assuming
since you didnt specify an actual NamedSearch ID, it probably is just getting you all the Details it can find in the entire system. Use RuntimeSearch.
Lately I always use BOReader… but man if I remember correctly the Epicor searches some of them, did a post-filter and didnt filter during the SQL Query. Kind of a… “get me all”, “then filter”.
Although the runtime search worked, it still took a long time to run, so I wound up using something different.
All I needed to know is if there was an existing order line. Here’s what I ended up with:
bool result = false;
OrderDtlSearchAdapter adapterOrder = new OrderDtlSearchAdapter(this.oTrans);
adapterOrder.BOConnect();
bool found = adapterOrder.GetByID(Convert.ToInt32(quoteOrderNum), Convert.ToInt32(quoteOrderLineNum));
if (found) result = true;
/*
foreach(DataRow row in adapterOrder.OrderDtlSearchData.OrderDtl)
{
if (Convert.ToInt32(row["OrderLine"]) == quoteOrderLineNum) result = true;
}
*/
adapterOrder.Dispose();
if (!result)
{
intQuoteOrderLine.Value = 0;
throw new Ice.BLException("This is not a valid order.");
}