Skip to Content
0
Feb 25, 2021 at 05:35 PM

Using SQL query in .NET dynamic code for B1 UP validation

187 Views

Hi Experts!

I have some code that creates a SQL string and then uses it as a query with the 'Recordset.DoQuery' method of the SAP Business One .NET framework.

I have been following an online tutorial. However, I am not able to get the code to run and assign the value correctly.

Also, is it not possible to use a value from the UI in the dynamic .NET code in this way? Do I not have access to those variables?

Any help would be much appreciated. Here is my code:

string query = "SELECT LastPurPrc FROM OITM WHERE ItemCode LIKE $[$4.0.0]";

SAPbobsCOM.Recordset rs = (SAPbobsCOM.Recordset)company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

int result = rs.DoQuery(query);

Thanks again,

Alex