ODBC Driver for Sage 50 UK

Build 24.0.9060

Querying Data

After Connecting, you can execute a SQL statement and retrieve the results.

SELECT Procedure

You can use the query method to execute the statement. It will split the query results into batches, and invoke a callback once for each batch. The rows are given to the callback as a list of objects, along with a flag indicating whether more rows are available.

db.open("...", (err) => {
    db.query("SELECT TradingAccountUUID, Name FROM TradingAccounts WHERE TradingAccountUUID = 'c2ef66a5-a545-413b-9312-79a53caadbc4'", (err, rows, moreRows) => {
        for (var i = 0; i < rows.length; i++) {
            var row = rows[i];
            console.log("TradingAccountUUID = " + row["TradingAccountUUID"]);
            console.log("Name = " + row["Name"]);
        }

        if (!moreRows) {
            console.log("All rows have been processed");
        }
    });
});

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060