Click here to Skip to main content
15,844,155 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hello my beloved senior...

i'm using VB. i have about 6702 record of employee.
the problem is my application have to process the data and stored it into another table but it takes too much time.

i'm using:
1. progress bar to see the progress.
2. "do while", i'm calling the procedure to insert the data at the end of "do..while"

So i execute the proc equals to the amount of the employee.

here some of my code:

            ' loop-------------------
            ProgressBar1.Maximum = Me.bindingsource.Count
            Do While x <= Me.dataset.tbdatapegawai.Count
                Progress_bar_percent = x / CInt(Me.bindingsource.Count) * 100
                Me.persenLabel.Text = Progress_bar_percent.ToString & "%"

                'this is only example. the data that has been calculate and ready to be stored
                var_1_pajak = 12.000
                var_2_bruto = 5.000
                var_3_potongan = 2.000
                var_4_gasih = 1.500
                var_5_potjabatan = 1.725
                var_6_iuranpensiun = 900

                'saving one data using stored proc (just insert data)

                ProgressBar1.Value = x
                x = x + 1

it takes about 18 minutes to finish all the data.
is there a way to make it faster?
thanks for your time.
sorry about my english.

Samuel T
Updated 8-Aug-11 5:14am
Herman<T>.Instance 8-Aug-11 10:18am    
what data from table 1 is copied to table 2? Should this be done rowwise or can this be done tablewise with 1 query or stored procedure with conditions?
Samuel_Tandibua 8-Aug-11 10:39am    
the data from table 1 using some calculation for each field into some result and then it's stored into table 2.

thanks for reading my problems

1 solution

you can do an insert in a table based on a select from another table. The select can contain calucaltions. In thsi case your process can be done in 1 query in a couple of seconds (7k records is nothing for a database!)

For an example see:[^]
Share this answer
Samuel_Tandibua 8-Aug-11 10:36am    
i think it's not gonna work.
var_1_pajak = 12.000
var_2_bruto = 5.000
var_3_potongan = 2.000
var_4_gasih = 1.500
var_5_potjabatan = 1.725
var_6_iuranpensiun = 900
those variable are from calculation after that it's being stored into another table. can sql do some complex calculation? if there any article i would appreciate it.
thanks for reading my problem.
Herman<T>.Instance 8-Aug-11 10:52am    
Computed columns
Samuel_Tandibua 10-Aug-11 23:00pm    
Thank you very much.
it pretty much solved my problem.

sorry for the trouble.

samuel t

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900