Knowledgebase
[QODBC-Desktop] Error - QuantityOnHand Returns Null via MSSQL Despite Successful QODBC Test Tool Connection
Posted by William - QODBC Support on 16 October 2026 11:55 AM

[QODBC-Desktop] Error - QuantityOnHand Returns Null via MSSQL Despite Successful QODBC Test Tool Connection

Problem Description:

When querying inventory fields such as QuantityOnHand from MS SQL Server or another application using QODBC, the value returns NULL even though the QODBC Test Tool reports a successful connection and returns the expected value. The issue occurs when Dirty Read is not enabled in the QODBC DSN configuration.

Affected products: QODBC Desktop, QuickBooks Desktop, MS SQL Server
Expected outcome: After enabling Dirty Read (and optionally SQL Server Support) on both 32-bit and 64-bit DSNs, inventory field queries return correct values.

Symptoms:

  • QuantityOnHand returns NULL when queried via MS SQL Server or an application linked through QODBC.
  • The QODBC Test Tool connects successfully and shows the expected value for the same field.
  • The issue is isolated to external application queries - QuickBooks itself works normally.
  • The problem appears when querying inventory-related tables (Item, InventoryAssembly, etc.).

Cause:

QuickBooks stores inventory data in a way that requires a dirty read to retrieve the most recent values. If Dirty Read is not enabled in the QODBC DSN configuration, the driver will return NULL for fields like QuantityOnHand when queried through external applications.

Additionally, if SQL Server Support is disabled in the Advanced tab, MSSQL-based queries may not function correctly even with Dirty Read enabled.

Note

The QODBC Test Tool uses its own connection settings and may have Dirty Read enabled by default - which is why it works while external applications (MS Access, SQL Server linked tables) fail.

Environment:

ProductVersion / Detail
QODBC Desktop All versions
QuickBooks Desktop All editions (Enterprise, Pro, Premier)
Data Source Tools MS SQL Server, MS Access, Excel Power Query

Solution:

Step 1: Enable Dirty Read on Both DSNs

  1. Enable Dirty Read for the 32-bit DSN:
    • Open Start → All Programs → QODBC Driver for QuickBooks → Configure 32-Bit QODBC Driver → System DSN tab
    • Select QuickBooks Data (32-bit) and click Configure
    • Navigate to the Optimizer tab
    • Check the box for "Dirty Reads"
  2. Enable Dirty Read for the 64-bit DSN:
    • Open Start → All Programs → QODBC Driver for QuickBooks → Configure 64-Bit QODBC Driver → System DSN tab
    • Select QuickBooks Data (64-bit) and click Configure
    • Navigate to the Optimizer tab
    • Check the box for "Dirty Reads"

Step 2: Enable SQL Server Support (if using MS SQL Server)

  1. For the 32-bit DSN: Navigate to the Advanced tab and enable "SQL Server Support".
  2. For the 64-bit DSN: Navigate to the Advanced tab and enable "SQL Server Support".

Step 3: Test Your Query

  1. Restart your application (MS SQL Server Management Studio, MS Access, Excel Power Query, etc.).
  2. Re-run the query. QuantityOnHand should now return the correct value instead of NULL.

SQL Examples:

After enabling Dirty Read, standard queries will work correctly:

SELECT Name, QuantityOnHand, IsActive FROM ItemInventoryAssembly
SELECT * FROM Item WHERE QuantityOnHand > 0

Example Scenarios:

Before the fix:

A customer queried Inventory through MS SQL Server and received NULL for QuantityOnHand. The QODBC Test Tool showed a successful connection with the correct value, leading to confusion about whether the issue was with QODBC or the data source.

After the fix:

Dirty Read was enabled in both the 32-bit and 64-bit DSN configurations. After restarting MS SQL Server and re-running the query, QuantityOnHand returned the expected value.

Additional Notes:

  • Dirty Read vs. 32/64-bit bitness: Dirty Read is a separate setting from the 32-bit / 64-bit DSN configuration. Even if your DSN bitness matches QuickBooks (see the related article on 32-bit/64-bit matching), Dirty Read must be enabled independently in each DSN.
  • Dirty read behavior: A dirty read allows QODBC to return data that may not have been committed by QuickBooks yet. This is necessary for inventory fields but means data could change between reads during high-activity periods.
  • If Dirty Read does not resolve the issue: Delete and rebuild the optimizer file, then test again. For MS Access users, re-link the tables after rebuilding the optimizer. See Troubleshooting: Slow Performance / Cannot Get Full Records from QuickBooks for detailed steps on removing and rebuilding the optimizer.

How to Match 32-bit and 64-bit DSNs for QODBCUnderstanding QODBC Optimizer Settings

Keywords:

QODBC Dirty Read QuantityOnHand NULL Value SQL Server Support MS SQL Server Inventory 32-bit DSN 64-bit DSN Optimizer QuickBooks Desktop
(0 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please complete the captcha below (we use this to prevent automated submissions).