sql - Can I use the the power of Generics to solve my issue -


I have a strange issue that I'm loading 1k invoice objects, first in my head in the header, VB I am using Net. I'm able to fix the invoice headers just fine. When I load the details of each invoice, I get timeout on SQL Server. I increased the time period to 5 minutes but still the only thing if I reduce the invoice number to 200 then it works fine.

What I'm doing here

 // I have already loaded the invoice headers. I am now invoicing each invoice for each invoice, invoices as invoice Invoice drInvoiceItems = DBSqlHelperFactory.ExecuteReader (CONNECTION_STRING, CommandType.StandardProcessor, "dbo.getinvoiceitem", _ New SqlParameter ("@ invoicenumber", invoice number, invoice number)) drInvoiceItems.Read () invoice.LineItems.Add (New InvoiceLine ( DrInvoiceItems ("id"), drInvoiceItems ("inv_id"), drInvoiceItems ("prodid"), drInvoiceItems ("name"), drInvoiceItems ("barcode"), drInvoiceItems ("volume"), drI NvoiceItems ("costprice")) termination while the next return invoice 

I am aware that I am firing 1k connections to DB due to iterations. I can not load all line items with a select statement and then some

  invoice invoice.Items.Add (invoiceItems.Find (function (i InvoiceItem, for example), i.InvoiceNumber = invoice.InvoiceNumber) Next  

I use the lambda funcion whenusing error type 'System.Collections.Generic.List 1 value BizComm.InvoiceLine gets an error) 'BizComm.InvoiceLine' C: \ Projects \ BizComm \ InvoiceDAL.vb 75 35 BizComm

One thing I use the same connection object for all required reading activities before in the past is through repetition when. It seems to increase performance greatly.

I also look at the database to see that the dbo.getinvoiceitem process could be improved, or any other process could be written, which would be only one at a time Instead of headers, you provide all line items for the invoice group (probably by date or customer / vendor), then you can effectively apply your recurrence to the invoice collection and add lines to the header.

You can also see if there is an effective index on the column, which is @invoicenumber parameter reference.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -