Connecting Tech Pros Worldwide Forums | Help | Site Map

Threads question

Brad
Guest
 
Posts: n/a
#1: Nov 21 '05
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



Chris Botha
Guest
 
Posts: n/a
#2: Nov 21 '05

re: Threads question


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.

"Brad" <ballison@ukcdogs.com> wrote in message
news:egDfpgIBFHA.3528@tk2msftngp13.phx.gbl...[color=blue]
>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
>
>[/color]


Chris Botha
Guest
 
Posts: n/a
#3: Nov 21 '05

re: Threads question


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.

"Brad" <ballison@ukcdogs.com> wrote in message
news:egDfpgIBFHA.3528@tk2msftngp13.phx.gbl...[color=blue]
>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
>
>[/color]


Brad
Guest
 
Posts: n/a
#4: Nov 21 '05

re: Threads question


Chris,

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

Brad


"Chris Botha" <chris_s_botha@.AT.hotmail.com> wrote in message
news:O$C9huIBFHA.3512@TK2MSFTNGP10.phx.gbl...[color=blue]
> 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.
>
> "Brad" <ballison@ukcdogs.com> wrote in message
> news:egDfpgIBFHA.3528@tk2msftngp13.phx.gbl...[color=green]
>>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
>>
>>[/color]
>
>[/color]


Brad
Guest
 
Posts: n/a
#5: Nov 21 '05

re: Threads question


Chris,

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

Brad


"Chris Botha" <chris_s_botha@.AT.hotmail.com> wrote in message
news:O$C9huIBFHA.3512@TK2MSFTNGP10.phx.gbl...[color=blue]
> 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.
>
> "Brad" <ballison@ukcdogs.com> wrote in message
> news:egDfpgIBFHA.3528@tk2msftngp13.phx.gbl...[color=green]
>>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
>>
>>[/color]
>
>[/color]


Cor Ligthert
Guest
 
Posts: n/a
#6: Nov 21 '05

re: Threads question


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


Cor Ligthert
Guest
 
Posts: n/a
#7: Nov 21 '05

re: Threads question


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


Brad
Guest
 
Posts: n/a
#8: Nov 21 '05

re: Threads question


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


"Cor Ligthert" <notmyfirstname@planet.nl> wrote in message
news:%23SWVOGJBFHA.3820@TK2MSFTNGP11.phx.gbl...[color=blue]
> 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
>[/color]


Brad
Guest
 
Posts: n/a
#9: Nov 21 '05

re: Threads question


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


"Cor Ligthert" <notmyfirstname@planet.nl> wrote in message
news:%23SWVOGJBFHA.3820@TK2MSFTNGP11.phx.gbl...[color=blue]
> 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
>[/color]


Cor Ligthert
Guest
 
Posts: n/a
#10: Nov 21 '05

re: Threads question


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




Cor Ligthert
Guest
 
Posts: n/a
#11: Nov 21 '05

re: Threads question


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




Closed Thread


Similar Visual Basic .NET bytes