Im new to VB and need your advice on my current project, Im working an app that generates invocies for our customers, and saves them as pdf. we have a SQL backend holding all the data. my problem is that when I send to print 15K invoices it takes too long to generate the pdf. Here is where im looking for your advise..
Here is what im doing now and my table structure
custtable servicetypetbl detailsofservctbl dynamicmsgtbl
each cust will have 1 or many services and each service will have multiple details.
what im doing now is, I query the first 2000 id's from the customer table into a datatable, then i do a for each whit the resiults and query each of the tables where cust id match and put those resutls into datables.
something like this:
select top 2000 ID from custable
c as datatable from above select
for each in mem in c
here i create another dataadapter and fill a dataset with a select where id = c for
each of the following tables servicetypetbl detailsofservctbl dynamicmsgtbl
This works fine and generates my pdf's. my problem is that when i try to print 30K invoices takes for ever in excess of 4 hours.
I'm sure there is a way to avoid soo many tris back and forth to the database - any suggestions are greatly appretitated.