cancel
Showing results for 
Search instead for 
Did you mean: 

Execute sql query in sdk

dilipkumbhar
Participant
0 Kudos

I am using SAP Business One 9.2. I have a user defined table and I am using ADO.NET for executing sql query.

[code]

strQuery = "DELETE FROM [@U_RDLCH_ITEM_SERIAL] WHERE U_DC_No=10"

ExecuteQuery(strQuery)

[/code]

In the ExecuteQuery function , I have used ADO.NET for executing this query.Is there any way in sdk to execute such query ?

Accepted Solutions (0)

Answers (3)

Answers (3)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert

Hi dilipkumbhar,

Refer to the blog post for Guidelines for Modifying SAP Business One Data.

This should answer your question. It is ok for User Defined Tables (UDTs) of type [No Object & No Object with Auto. Increment] only.

Hope it helps!

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

dilipkumbhar
Participant
0 Kudos

Dear Aniket,

I want to execute update and delete queries on the user defined tables. Can I use oRecordSet.DoQuery method for executing such queries ?

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi dilipkumbhar,

Recordset is a raw data access object that enables you to select data from the database, navigate through the result set, and manipulate user tables, which are not exposed by the DI API.

In SAP Business One SDK, you can use the Recordset object the following way:

SAPbobsCOM.Recordset oRecordSet = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
oRecordSet.DoQuery("select \"CardCode\", \"CardName\" from OCRD");

Hope it helps!

Kind regards,

ANKIT CHAUHAN

SAP Business One Support