How to use CSQRY using COMAPI in C#

By | August 31, 2020

CSQRY is the standard Sage 300 View CS0120. It basically takes the SQL Query as the parameter to its Browse method and then returns the records via calls to Fetch. CSQRY is easy to execute general SQL statements through the Sage 300 API. This way we don’t need additional database credentials and don’t need to use an alternate API like ODBC.

New Stuff: Sage 300c 2020 PU2 released has fixed the issue related to Order Entry screen

Step 1:

Include the Sage 300 COMAPI in the project.

Step 2:

Once the COMAPI is included, create the object of the DBLink and open the “CS0120” using DBLink object.

Step 3:

Pass the SQL Query in Browse method as string parameter.

Step 4:

Now we call the Fetch method to return the results.

Here is the sample code of how to use CSQRY view using COMAPI, just in case you are not aware of how to use it…

GUMU Integration App

The result will comes up as per the SQl statement and which can be used for further operations.

About Us

Greytrix – a globally recognized and one of the oldest Sage Gold Development Partner is a one-stop solution provider for Sage ERP and Sage CRM organizational needs. Being acknowledged and rewarded for multi-man years of experience, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third party add-on development and implementation competence.

Greytrix offers unique GUMU™ integrated solutions of  Sage 300 with Sage CRM,, Dynamics 365 CRM and Magento eCommerce along with Sage 300 Migration from Sage 50 US, Sage 50 CA, Sage PRO, QuickBooks, Sage Business Vision and Sage Business Works. We also offer best-in-class Sage 300 customization and development services and integration services for applications such as POS | WMS | Payroll | Shipping System | Business Intelligence | eCommerce for Sage 300 ERP and for Sage 300c development services we offer, upgrades of older codes and screens to new web screens, latest integrations using sData and web services  to Sage business partners, end users and Sage PSG worldwide. Greytrix offers 20+ addons for Sage 300 to enhance productivity such as GreyMatrixDocument AttachmentDocument NumberingAuto-Bank ReconciliationPurchase Approval SystemThree way PO matchingBill of Lading and VAT for Middle East. The GUMU™ integration for Dynamics 365 CRM – Sage ERP is listed on Microsoft Appsource with easy implementation package.

For more details on Sage 300 and Sage 300c Services, please contact us at, We will like to hear from you.