Grab part from specified company (object not set to instance of of an object)

I am using:

adapterPart.GetByID(row["MtlPartNum"].ToString());

but when I run a sql query it returns 4 records for each company the part is in. How can I get the specified one? Should I make a baq or can I make this work another way?

Check your row index. Is this in a loop? Need to see where “row” is defined

It grabs that correctly. It is in a loop.

Depending on how you are returning your adapterPart, you might consider a SearchOptions to define what company it’s using

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

maybe?

1 Like