I have a process that does a lot of data manipulation and then prints a simple report directly to a printer. The overall priority is speed. Tens of thousands of records need to be scanned & processed individually so moving thru them quickly as possible is the goal.

Pseudo code

01) Scan Barcode
02) Fill DataSet from Sql Server
03) Manipulate data in dataset
04) Update data back to Sql Server
05) Print crystal report directly to printer; the dataset is the reports source
06) Clear dataset and start next record back at step one

The process if pretty complicated with a ton data manipulation and data coming from multiple sources but that part works super and in short all I am doing is scanning barcode, filling a dataset, passing it to a report and starting over.

Steps 1 to 4 are averaging one tenth of a second (0.01) to complete; great. Passing it to the report to print takes several seconds which is the problem. I thought I would resolve this by passing the dataset to the report print sub – allowing the print sub to run on a background thread – and moving on to processing the next record.

Dim m_ds As MyTypedDataSet

Sub ScanBarCode

Fill DataSet
Validate & Manipulate Data
Call PrintReport
Clear Dataset

End Sub

-----------------------------------

I have been attempting to add the PrintReport sub to process on a background thread. The problem though is the main thread blows right by to the next step and clears the dataset; causing an error in the report sub. I’ve tried unsuccessfully just about everything I can think of; including using DataSet.Copy to local datasets (which I really don’t want to keep recreating the same object over & over tens of thousands of times), as soon as the main dataset clears, all clear.

Any suggestions?

I would suggest to use pull model reporting services.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.