ERP 10.2.500.7 - 'Ice.BO.QueryExecutionDataSet' does not contain a definition for 'AddExecutionParameterRow' and no extension method 'AddExecutionParameterRow' accepting a first argument of type 'Ice.BO.QueryExecutionDataSet' could be found

I’m trying to execute a BAQ from code within a customization I’m building. I’m receiving the following error when I attempt to compile my custom code:
‘Ice.BO.QueryExecutionDataSet’ does not contain a definition for ‘AddExecutionParameterRow’ and no extension method ‘AddExecutionParameterRow’ accepting a first argument of type ‘Ice.BO.QueryExecutionDataSet’ could be found (are you missing a using directive or an assembly reference?)

and

The type ‘Ice.BO.QueryExecutionDataSet’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘Ice.Contracts.BO.DynamicQuery, Version=3.2.500.0, Culture=neutral, PublicKeyToken=5d3fa3c7105d7992’.

Jose Gomez made a fantastic video on this subject which was very helpful: Calling BAQ from Code Epicor ERP 10 - YouTube

However, despite following the steps as they laid out in said video, it still appears that I’m missing an assembly reference somehow. My code is below:

// **************************************************
// Custom code for PurchaseAdvisorEntryForm
// Created: 2/19/2020 3:35:04 PM
// **************************************************

extern alias Erp_Contracts_BO_Part;
extern alias Erp_Contracts_BO_PartOnHandWhse;
extern alias Ice_Contracts_BO_DynamicQuery;

using System;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.Adapters;
using Erp.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.BO;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
//using Ice.Contracts.BO.DynamicQuery;

public class Script
{
// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
// Begin Wizard Added Module Level Variables **

// End Wizard Added Module Level Variables **

// Add Custom Module Level Variables Here **

public void InitializeCustomCode()
{
	// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
	// Begin Wizard Added Variable Initialization

	// End Wizard Added Variable Initialization

	// Begin Wizard Added Custom Method Calls

	// End Wizard Added Custom Method Calls
	EpiTextBox txtBxPart = (EpiTextBox)csm.GetNativeControlReference("3afce703-4eaa-4ac6-aeeb-fd0f18caf2c8");
	txtBxPart.TextChanged += new System.EventHandler(PartNumberChange);
}

public void DestroyCustomCode()
{
	// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
	// Begin Wizard Added Object Disposal

	// End Wizard Added Object Disposal

	// Begin Custom Code Disposal

	// End Custom Code Disposal
	EpiTextBox txtBxPart = (EpiTextBox)csm.GetNativeControlReference("3afce703-4eaa-4ac6-aeeb-fd0f18caf2c8");
	txtBxPart.TextChanged -= new System.EventHandler(PartNumberChange);
}

private void PartNumberChange(object sender, EventArgs args)
{
	MessageBox.Show("Change fired");
	string company = oTrans.CoreSession.CompanyID;
	EpiTextBox txtBxPart = (EpiTextBox)csm.GetNativeControlReference("3afce703-4eaa-4ac6-aeeb-fd0f18caf2c8");
	string partNum = txtBxPart.Value.ToString();	

	DynamicQueryAdapter queryAdapter = new DynamicQueryAdapter(oTrans);
	queryAdapter.BOConnect();
	
	QueryExecutionDataSet qeds = queryAdapter.GetQueryExecutionParametersByID("UD_PurPartsRunningTotal");
	qeds.ExecutionParameter.Clear();
	qeds.AddExecutionParameterRow("company", company, "nvarchar",false, Guid.NewGuid(), "A");
	qeds.AddExecutionParameterRow("partNumber", partNum, "nvarchar",false, Guid.NewGuid(), "A");
	
	
	
}
}

I made sure to add the “DynamicQueryAdapter” assembly reference was added per the video:
image
but I still appear to be missing something.

The second error seems pretty straight forward to resolve, but when I attempt to add a using statement for Ice.Contracts.BO.DynamicQuery, I receive the error “The type or namespace name ‘BO’ does not exist in the namespace ‘Ice.Contracts’ (are you missing an assembly reference?)”. This has me more than a little bit confused since I’m pretty sure ‘BO’ does exist within Ice.Contracts 0_o
image
If I just add a using statement for Ice.Contracts, I receive the original 2 errors.

I’m trying to use dnSpy as best I can to figure this out on my own, but I’m pretty new to this tool and c# in general so any assistance would be appreciated.

Can you look in the Assembly Reference Manager and verify that these two files actually show up?

image

Also try saving, then exit the customization and go back in.
I can’t remember if it was with this adapter, but I’ve seen it not compile, but saving, closing, and re-opening it seemed to clear up whatever was wrong.

Absolutely - sorry I should have included screenshots in my initial description

EDIT: Posted this before I saw your second recommendation. Unfortunately, it doesn’t look saving and relaunching resolved it either:

1 Like

That should be qeds.ExecutionParameter.AddExecutionParameterRow(“company”, company, “nvarchar”,false, Guid.NewGuid(), “A”);

Same thing for your other parameter.

1 Like

… I hereby revoke my “not a moron” card … wow I feel stupid. Couldn’t see the forest through the trees

1 Like