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 exact 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.
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("", strLineDescription)
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.
Workaround of this problem is to pass value in string format instead of actual format as 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);
|