LotSelectUpdateAdapter Search

Hi

I’ve used calls like this client side many times, but for the life of me can’t work out what I’ve got wrong here… please can somebody put me out of my misery!

LotSelectUpdateAdapter adLot = new LotSelectUpdateAdapter(this.oTrans);
adLot.BOConnect();
	
string whereClause = "LotNum like '" + lotNum + "%'";
bool morePages;
				
SearchOptions opts = new SearchOptions(SearchMode.AutoSearch);
opts.DataSetMode = DataSetMode.RowsDataSet;
opts.NamedSearch.WhereClauses.Add("PartLot", whereClause);
opts.PageSize = 1;
	      
MessageBox.Show(whereClause);

adLot.GetRows(opts, out morePages);

MessageBox.Show(lotNum + adLot.LotSelectUpdateData.PartLot.Rows.Count.ToString());

I have confirmed that my whereClause is correct and valid by using BLTester - finds a few record matching the like search clause very quickly.

I’m verifying the lotNum being passed it correct, and also that there are 0 rows returned on the client side customisation.

Am I doing something incorrect on the setting up of the search?

You might want to try instead of adding a named search to do something like this:

//Fill a DataTable from an adapter data and use the InvokeSearch method with a SearchOptions input. 
private static DataTable dtSerivceOption;

UserCodesAdapter adapterUserCodes = new UserCodesAdapter(oTrans);
adapterUserCodes.BOConnect();
SearchOptions opts = new SearchOptions(SearchMode.AutoSearch);
opts.PreLoadSearchFilter = "CodeTypeID = 'BoxOpts'";
opts.DataSetMode=DataSetMode.RowsDataSet;
adapterUserCodes.InvokeSearch(opts);

dtSerivceOption = adapterUserCodes.UserCodesData.UDCodes;
adapterUserCodes.Dispose();

And see if the PreLoadSearchFilter with your whereClause value behaves any different.

1 Like

Thanks Aaron.

That worked straight away which is great, but I’m still keen to know why the GetRows wasn’t working too!

1 Like

This is some insider info right here, thanks for the code @Aaron_Moreng

Haha no insider info here, just lots of experience of falling and scraping my knees on similar issues

2 Likes