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 : Error inserting into customersSearch Forum

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

 New Topic 
 
 Post Reply 
[1]  
 Error inserting into customers 
 Author   Message 
  Ian 
  
 Group: Members 
 Posts: 8 
 Joined: 2007-02-08 
 Profile
 Posted : 2007-02-08 08:10:50
I am using the following block of code to check if a customer is in Quickbooks and if not then insert him or her:

            query = "SELECT Name,FirstName,LastName,BillAddressAddr1,BillAddressAddr2,BillAddressAddr3,
            BillAddressCity,BillAddressState,BillAddressPostalCode,ShipAddressAddr1,ShipAddressAddr2,
            ShipAddressAddr3,ShipAddressCity,ShipAddressState,ShipAddressPostalCode,Contact,Phone,
            AltPhone,Email,AccountNumber,SalesTaxCodeRefFullName FROM Customer WHERE IsActive = 1
            and FirstName = '" & fname & "' and LastName = '" & lname & "'"

            CheckCust.Open(query, odbcConn, adOpenStatic, adLockOptimistic)

            If (CheckCust.Eof) Then
                Name = CustInfo("FName").Value + " " + CustInfo("LName").Value
                'Add new customer if no record was found in QB
                CheckCust.AddNew()
                CheckCust.Fields("Name").Value = Name
                CheckCust.Fields("FirstName").Value = CustInfo("FName").Value
                CheckCust.Fields("LastName").Value = CustInfo("LName").Value
                CheckCust.Fields("BillAddressAddr1").Value = Name
                CheckCust.Fields("BillAddressAddr2").Value = CustInfo("BAddr1").Value
                CheckCust.Fields("BillAddressAddr3").Value = CustInfo("BAddr2").Value
                CheckCust.Fields("BillAddressCity").Value = CustInfo("BCity").Value
                CheckCust.Fields("BillAddressState").Value = CustInfo("BState").Value
                CheckCust.Fields("BillAddressPostalCode").Value = CustInfo("BZip").Value
                CheckCust.Fields("ShipAddressAddr1").Value = Name
                CheckCust.Fields("ShipAddressAddr2").Value = CustInfo("SAddr1").Value
                CheckCust.Fields("ShipAddressAddr3").Value = CustInfo("SAddr2").Value
                CheckCust.Fields("ShipAddressCity").Value = CustInfo("SCity").Value
                CheckCust.Fields("ShipAddressState").Value = CustInfo("SState").Value
                CheckCust.Fields("ShipAddressPostalCode").Value = CustInfo("SZip").Value
                CheckCust.Fields("Contact").Value = Convert.ToString(CustInfo("CID").Value)
                CheckCust.Fields("Phone").Value = CustInfo("Phone1").Value
                CheckCust.Fields("AltPhone").Value = CustInfo("Phone2").Value
                CheckCust.Fields("Email").Value = CustInfo("Email").Value
                CheckCust.Fields("AccountNumber").Value = Convert.ToString(CustInfo("ONum").Value)

                If CustInfo("SState").Value = "CA" Then
                    CheckCust.Fields("SalesTaxCodeRefFullName").Value = "Tax"
                Else
                    CheckCust.Fields("SalesTaxCodeRefFullName").Value = "OS"
                End If

                CheckCust.Update()

In the last line, however I am getting the following error:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in microsoft.visualbasic.dll

Additional information: Multiple-step operation generated errors. Check each status value.

I have checked the value of each field and everything seems okay but I can't seem to get around the error.  The values are as follows:

CheckCust.Fields("Name").Value                "B******n W******s" {String}
CheckCust.Fields("FirstName").Value            "B******n" {String}
CheckCust.Fields("LastName").Value            "W******s" {String}
CheckCust.Fields("BillAddressAddr1").Value        "B******n W******s" {String}
CheckCust.Fields("BillAddressAddr2").Value        "*** S******k Drive" {String}
CheckCust.Fields("BillAddressAddr3").Value        "" {String}
CheckCust.Fields("BillAddressCity").Value        "Hilton Head Island" {String}
CheckCust.Fields("BillAddressState").Value        "SC" {String}
CheckCust.Fields("BillAddressPostalCode").Value        "29926" {String}
CheckCust.Fields("ShipAddressAddr1").Value        "B******n W******s" {String}
CheckCust.Fields("ShipAddressAddr2").Value        "*** S******k Drive" {String}
CheckCust.Fields("ShipAddressAddr3").Value        "" {String}
CheckCust.Fields("ShipAddressCity").Value        "Hilton Head Island" {String}
CheckCust.Fields("ShipAddressState").Value        "SC" {String}
CheckCust.Fields("ShipAddressPostalCode").Value        "29926" {String}
CheckCust.Fields("Contact").Value            "23157" {String}
CheckCust.Fields("Phone").Value                "843-681-****" {String}
CheckCust.Fields("AltPhone").Value            "" {String}
CheckCust.Fields("Email").Value                "******@yahoo.com" {String}
CheckCust.Fields("AccountNumber").Value            "12957" {String}
CheckCust.Fields("SalesTaxCodeRefFullName").Value    "OS" {String}

Only, obviously in place of asterisks there are either numbers or letters.  I just don't wanna give out my customer info.  Any help would be highly appreciated. 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2007-02-08 08:43:29
Please see the "Review QODBC Messages" message log from QODBC and the messages produced by the QuickBooks qbXML SDK interface for the real nature of the problem.  You should be able to see the offending typing of one of the columns.

 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to