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 : SP_LastInsertID Customer Not Returning ValueSearch Forum

Forum Home > QODBC - ODBC Driver for QuickBooks > QODBC SQL Support Forum

 New Topic 
 
 Post Reply 
[1]  
 SP_LastInsertID Customer Not Returning Value 
 Author   Message 
  Steve 
  
 Group: Members 
 Posts: 8 
 Joined: 2006-09-29 
 Profile
 Posted : 2007-04-26 10:51:02

I have a large customer table of about 16,000 records.  I'm using QODBC to check an online database and download new customers to QuickBooks and I use SP_LastInserID to grab the ListID for creating an invoice. (i'm using visual basic)

The insert customer works just fine, but SP_LastInsertID Customer does not return an value.  I've read about optimizing data, but I'm not sure how I should go about it in this case.

I've tried optimizing the customer table when the program starts, but it doesn't seem to work.

Any suggestions? 

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2007-04-26 13:56:02
SP_LastInsertID Customer needs to run without breaking the current connection. The most common reason for it not to work is because a connection close is executed after the insert. You need keep the connection open. 

  Top 
  Steve 
  
 Group: Members 
 Posts: 8 
 Joined: 2006-09-29 
 Profile
 Posted : 2007-04-27 01:35:34

I actually do keep the connection open.  I run the SP_LastInsertID statement right after the Insert:

sql = "insert blah blah blah"
set objrs = objconn.execute(sql)

sql = "SP_LastInsertID")
set objrs = objconn.execute(sql)

ListID = objrs(0)

This doesn't work.  If I come back into the program (which optimizes the customer table when it starts, I can find the customer by phone number.)

I've tried optimizing using the sp_optimizeupdatesync Customer right after the insert statement but this doesn't work either.

I can see the customer in QuickBooks, but the VP Demo can't find it and my program can't find it unless I do a full optimize.  With 16,000 + cusotmers and multiple inserts that need to be done at a time, this isn't working to well.

I also tried to skip the sp_LastInsertID and just search by phone number - same scenerio, I can not find the customer in either my program or the VB Demo until after I reoptimize the entire folder.

Any suggestions?  Thanks for your help!  I've written into this forum a couple times and I always appreciate your quick response.

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2007-04-27 08:30:57

Your code needs a table name here:

sql = "insert blah blah blah"
set objrs = objconn.execute(sql)

sql = "SP_LastInsertID customer")
set objrs = objconn.execute(sql)

My recommended settings for using QODBC are shown here. You need to check: Optimize data after an Insert or Update: causes QODBC to do "Load Updated Data" after an insert or update is executed on a table. Useful for programmers (like you) who what to test that their data has succesfully been written to QuickBooks.

 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to