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
|
|
Multiple Line in SalesOrder |
Author |
Message |
|
Posted : 2008-06-04 13:57:39 |
Hi
I am tring to insert line into Quickboks SalesOrderLine Table to create sales order.
I am user VC# to access quickbook with QODBC.
now normaly our sales orders contains around 50 line items and i just figure it out that to process
50 line items it took about 10 mins. what i have done it create a list of all the insert SQL as one line insert statement for one item and open the connection with STAThread and the start executing one query after one.
but 10 mins is very slow for me to process one order as i have around 100 to process in ane hour.
What will be the fastest way.
I took less then 1 sec to prepare all the querys to make it ready to insert only inserting to quickbook is talking 10 min for 50 line items.
If you have any idea that will be helpfull.
Note:
1. I am not doing any optimization
2. I am running in single user mode with admin login
3. I am running in single thread
4. I am trying to put as less information as possible in the insert query
5. Sample line:
INSERT INTO "SalesOrderLine" ("CustomerRefListID" ,"TemplateRefListID", "SalesOrderLineItemRefListID" , "SalesOrderLineDesc", "SalesOrderLineQuantity" , "SalesOrderLineAmount", "SalesOrderLineTaxCodeRefListID" ,"FQSaveToCache") VALUES('30000-1191208330', 'A0000-1191207024', '5BF0000-1198708857','true',0,0,'90000-1187321758',1 )
Thanks
Shanewaj |
|
|
Md Shanewaj Rahman
Software Developer
Nulab Professional Imaging Pty. Ltd. |
| Top | |
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2008-06-04 14:12:11 |
You can use sp_batch...... to process a batch of up to 500 transactions at a time.
QODBC Batch Stored Procedures
These allow you to start a batch for a given table and all insert/updates will be queued until the sp_batchupdate command is issued. This allows for fewer round trips to QuickBooks which increases performance when doing large transfers of records from external systems to QuickBooks.
The sp_lastinsertid stored procedure will return the ListID/TxnID plus an error message column for every row added to the batch.
Note: Each batch is limited to 500 transactions.
- sp_batchclear tablename – clears the current batch started with sp_batchstart.
- sp_batchstart tablename – starts a new batch. All inserts/update issued on this table will be batched until sp_batchupdate is issued.
- sp_batchupdate tablename – sends the batched transactions to QuickBooks. ListID/TxnIDs and error messages are available through sp_lastinsertid tablename.
For example:
BatchStart sp_batchstart InvoiceLine
BatchInsert1 INSERT INTO "InvoiceLine" ("CustomerRefListID", "RefNumber", "InvoiceLineItemRefListID", "InvoiceLineDesc", "InvoiceLineRate", "InvoiceLineAmount", "InvoiceLineSalesTaxCodeRefListID", "FQSaveToCache") VALUES ('AC0000-1197757899', 'Batch1', '250000-933272656', 'Bin Permit Renovations', 200.00000, 200.00, '20000-999022286', 0)
.......
BatchInsert400 INSERT INTO "InvoiceLine" ("CustomerRefListID", "RefNumber", "InvoiceLineItemRefListID", "InvoiceLineDesc", "InvoiceLineRate", "InvoiceLineAmount", "InvoiceLineSalesTaxCodeRefListID", "FQSaveToCache") VALUES ('AC0000-1197757899', 'Batch2', '250000-933272656', 'Bin Permit Renovations', 200.00000, 200.00, '20000-999022286', 0)
BatchUpdate sp_batchupdate InvoiceLine |
|
|
|
|
Posted : 2008-06-04 15:16:47 |
OK I have tryed This. What i have done is given bellow can u please have a look if i am doing it wrong
OdbcConnection con = new OdbcConnection(Settings.Default.QODBC);
con.Open();
string query = "sp_batchclear SalesOrderLine";
OdbcCommand cmd = new OdbcCommand(query, con);
cmd.ExecuteNonQuery();
query = "sp_batchstart SalesOrderLine";
cmd = new OdbcCommand(query, con);
cmd.ExecuteNonQuery();
foreach (object obj in insertList)
{
query = obj.ToString(); [ example is given bellow ]
cmd = new OdbcCommand(query, con);
cmd.ExecuteNonQuery();
}
query = "sp_batchupdate SalesOrderLine";
cmd = new OdbcCommand(query, con);
cmd.ExecuteNonQuery();
con.Close();
Example of SalesOrderLine Insert Query : SalesOrderLine" ("CustomerRefListID" ,"TemplateRefListID", "SalesOrderLineItemRefListID" , "SalesOrderLineDesc", "SalesOrderLineQuantity" , "SalesOrderLineAmount", "SalesOrderLineTaxCodeRefListID" ,"FQSaveToCache") VALUES('30000-1191208330', 'A0000-1191207024', '5BF0000-1198708857','true',0,0,'90000-1187321758',1 )
After Doing this it took 13 mins to process the same order which took 11 mins before.
Am i doing any thing wrong.
do i have to give any name or any special instraction to the query lines that i am inserting ??
Thanks
Shanewaj
|
|
|
Md Shanewaj Rahman
Software Developer
Nulab Professional Imaging Pty. Ltd. |
| Top | |
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2008-06-04 15:28:24 |
I had envisaged that you would be batching at least 8 sales orders at a time .... not just one sales order. Also, make sure that Optimize data after an Insert or Update is UNCHECKED!
|
|
|
|
|