[QODBC-Desktop] Troubleshooting - QRemote Does not consider FQSaveToCache with working with OdbcCommand & Parameters
Posted by Jack - QODBC Support on 06 May 2015 06:53 AM

Troubleshooting - QRemote Does not consider FQSaveToCache with working with OdbcCommand & Parameters

Problem Description:

QRemote Does not consider FQSaveToCache with working with OdbcCommand & Parameters.

I have an application that creates Sales Orders. This is what I execute for each line item:

Running this code against QODBC DSN works well if everything is local - using a 32-bit local DSN and QuickBooks local to the application. The Sales Order appears correct in QuickBooks.

Taking the same code and connecting it to a 64-bit QRemote DSN connected to a 32-bit qODBC DSN on another machine (via QRemote Server) does not work.

The basic flow is like this:

cnQODBC = New OdbcConnection(ConfigurationManager.AppSettings.Item("QuickBooksConnectionString"))

cnQODBC.Open()

[Repeat for every sales order line item]

Dim cmdQODBC As OdbcCommand = New OdbcCommand("insert into SalesOrderLine (CustomerRefListID, TxnDate, SalesOrderLineClassRefListID, TemplateRefListID, RefNumber, " & "SalesOrderLineItemRefListID, SalesOrderLineDesc, SalesOrderLineQuantity, SalesOrderLineRate, SalesOrderLineAmount, " & "CustomFieldSalesOrderLineOther1, FQSaveToCache) values (??, ??, ????????)", cnQODBC)

cmdQODBC.Parameters.AddWithValue(", "strCustomerListID)

cmdQODBC.Parameters.AddWithValue("", "{d'" & dteInvoiceDate.ToString("yyyy-MM-dd") & "'}")

cmdQODBC.Parameters.AddWithValue(", "strLineClassListID)

cmdQODBC.Parameters.AddWithValue(", "strTemplateListID)

cmdQODBC.Parameters.AddWithValue("", intSalesOrderNumber)

cmdQODBC.Parameters.AddWithValue("", strLineItemListID)

cmdQODBC.Parameters.AddWithValue(", "strain description)

cmdQODBC.Parameters.AddWithValue(", "intQuantity)

cmdQODBC.Parameters.AddWithValue(", "dblLineRate)

cmdQODBC.Parameters.AddWithValue(", "dblLineAmount)

cmdQODBC.ExecuteNonQuery()

[End repeat]

cnQODBC.Close()

cnQODBC = Nothing

cmdQODBC.ExecuteNonQuery()

Solutions:

Integer, double, and long datatype parameter passing in QRemote pass-through string format because of flow QRemote Client --> QRemote Server --> QODBC Datatype conversion create the problem in QODBC and due to this issue occurred.

The workaround for this problem is to pass value in string format instead of basic format as in the below example:

cmdQODBC.Parameters.AddWithValue("", intSalesOrderNumber.ToString()) //cmd.Parameters.AddWithValue("", "3");

cmdQODBC.Parameters.AddWithValue("", intQuantity.ToString()) //cmd.Parameters.AddWithValue("", "44.2");

cmdQODBC.Parameters.AddWithValue("", dblLineRate.ToString()) // cmd.Parameters.AddWithValue("", "113.4");

cmdQODBC.Parameters.AddWithValue("", dblLineAmount.ToString()) //cmd.Parameters.AddWithValue("", "0");

Instead of

cmdQODBC.Parameters.AddWithValue("", intSalesOrderNumber) //cmd.Parameters.AddWithValue("", 3);

cmdQODBC.Parameters.AddWithValue("", intQuantity) //cmd.Parameters.AddWithValue("", 44.2);

cmdQODBC.Parameters.AddWithValue("", dblLineRate) //cmd.Parameters.AddWithValue("", 113.4);

cmdQODBC.Parameters.AddWithValue("", dblLineAmount) //cmd.Parameters.AddWithValue("", 0);

(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).