Member Login

Username
Password
Forget Password
New Sign Up
Search Forum

Buy Support
Incidents

If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:

Click Here
If you can't login and post questions or you are having trouble viewing forum posts:
Click Here
Callback
Support

If you live in USA, UK, Canada, Australia or New Zealand, you can leave us details on your question and request us to call you back and discuss them with you personally  (charges apply).

Click Here
 
Buy Support
Incidents
If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:
Click Here

Forum : Verifying if Insert statement workedSearch Forum

Forum Home > QODBC - ODBC Driver for QuickBooks > QODBC v9 Forum

 New Topic 
 
 Post Reply 
[1]  
 Verifying if Insert statement worked 
 Author   Message 
  PH 
  
 Group: Members 
 Posts: 41 
 Joined: 2007-02-02 
 Profile
 Posted : 2008-10-23 07:29:09

I am using ADO via MS-Access VBA to connect QODBC:

Set cn = CreateObject("ADODB.Connection")
cn.Open "DSN=Quickbooks Data;OLE DB Services=-2;"

I can check if this is successful by testing adStatus, no problem there.

Then I am adding bill line items through an INSERT statement with cn.Execute

How may I then determine if the INSERT worked?  Do I check the number of records affected?

The format of the Execute Command is as follows.  Do you recommend any Options?

connection.Execute CommandText, RecordsAffected, Options

One other question:

When I am inserting serveral bill line items, should I use the ADO transaction/rollback or should I use the batch SP's provided by QODBC or both?

Thanks

 

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2008-10-23 08:02:06

First of all, there's no transaction engine in QODBC. QODBC simply takes SQL Statements and converts then to XML requests that are sent to QuickBooks, which then executes the request and returns a result. There's no database to rollback. SP_BATCH is only used for large batches of inserts.

Secondly, to verify that the transaction has been successfuly written really requires another query request to be sent to QuickBooks.

 

  Top 
  PH 
  
 Group: Members 
 Posts: 41 
 Joined: 2007-02-02 
 Profile
 Posted : 2008-10-23 08:23:57

Thanks for your prompt reply.

Looks like QODBC returns error codes and descriptions, so does one use ordinary error trapping for those?  "ON ERROR ..."

Any sample code for another query request to Quickbooks to confirm a successful Insert?

RecsAffected returns 1 for each bill line insert.  Would that have been the case even if it's not successful?

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2008-10-23 08:37:06

The call to execute immediately after the last insert for a transaction (without breaking the connection is):-

SP_LASTINSERTID tablename

It will return a TxnID if successful. For an example see: SP_LASTINSERTID 

 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to