How to cancel FQSaveToCache in QODBC
We have some code to insert multiple lines into invoice table. We understand how 'FQSaveToCache' field is used during this process. And the code is running successfully until we found an issue. After 1st line inserted, the 2nd line may have some missing data so the code decides to stop inserting. However the 1st line is still in cache, and it might be inserted into QB with the following other invoices. So we need to know how to cancel the insertion and remove everything from the cache before it starts to insert other invoices. Can you let us know which command should we call?
Multi-line insert require a series of SQL statements to complete a single transaction.
The key to this process is the field named "FQSaveToCache". This field is not part of the table, but is used as a flag to the QODBC driver. The value of "FQSaveToCache" is set to 1 or TRUE for the first line item insert statements, and then it is set to 0 or FALSE for the final statement.
A TRUE setting of "FQSaveToCache" instructs QODBC to take the values from your INSERT statement and hold them for later processing, but not to save them to QuickBooks yet. When QODBC receives the final transaction where the cache is set to 0 or FALSE, the contents of the current INSERT statement will be combined with all of the previous INSERT statements held in the cache for this connection, and saved as a batch into QuickBooks.
QODBC maintains a connection for each application using the driver, and this cache is specific for each connection, so multiple applications or users of QODBC will not interfere with the cached transactions of other users. There is no set limit to the number of lines that can be cached for a single transaction, other than what QuickBooks would limit you to.
I would like to suggest you to please close/dispose your current connection with QODBC & connect it again. When the connection is close with QODBC, QODBC will cancel FQSaveToCache for that particular connection.