Threads question

B

Brad

I need to learn about threads and threading. I currently have a process
that is pulling 10 to 12 thousand records from the AS400 and formatting the
data then storing into a SQL server. This process is taking just over one
hour and I would like a progress bar or something to show that it is
actually working and I guess this would be done using threads.

Can somebody give me a link to some good starter information on threads

If it makes a difference, I am using VB .Net.

Thanks,

Brad
 
C

Chris Botha

To save yourself a lot of trouble, in the main program, in the loop, update
your progress bar and call Application.DoEvents().
Calling Application.DoEvents allow windows controls to be updated during the
processing, your form can be minimized, etc.
Threads can not update UI controls directly, the main thread has to wait for
other threads to terminate when terminating the app, etc.
 
B

Brad

Chris,

Thanks for the advice. That is exactly what I needed and it is working
fine.

Brad
 
C

Cor Ligthert

Brad,

The way you get it from the AS400 is important to answer your question, so
how do you do that.

I do now not see the needs for threads, that could be when you were getting
it from more AS400's.
(And the process of the AS400's are than slower than from your processing
computer)

Cor
 
B

Brad

Cor,

I am using an ODBC dataset to pull in the data from the AS400. For each row
I am formatting the data to match how we need it for this particular project
and that data is being saved in an MSDE SQL database. It is a really slow
process.

Brad
 
C

Cor Ligthert

Brad,

This is of course a typical a process for a queu as you describe it.

However first you have to find out if the slow processes are on both end of
the queu or that it is only one point.

When the action will be that the AS400 process is always filling an empty
queu or that the SQL process is always waiting on a filled queu, than you
will only create overhead and probably win maximum the processing of one
records on either side. That time you will loose with polling the queu.

In other words both processes have to be both slow and that slow has to be
because of the external part.

When you want a progress bar, that is very easy, you needs to know the
records what is the max value and the steps 1/recordcount and than you can
every time perform a step when you insert a record in your sql server.

Just some thoughts

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top