Script & Progressbar

Script & Progressbar

Postby Zero-G. » Tue 08 Apr 2008 14:20

Hey
I use VB.NET 2005 and your latest Controls
Is it possible to show the status of a script in a progressbar?

If possible please give me a VB Sample.

THX
Zero-G.
 
Posts: 390
Joined: Sat 09 Dec 2006 12:20

Postby Alexey.mdr » Wed 09 Apr 2008 10:00

Here is a small sample, though it's written in C# I hope you can easily get the idea.
Code: Select all
        private int counter = 1;
        private int all = 0;

        private void Form1_Load(object sender, EventArgs e) {
            all = mySqlScript1.Statements.Count;
            mySqlConnection1.Open();
            mySqlScript1.Execute();
        }

        private void mySqlScript1_MySqlStatementExecute(object sender, CoreLab.MySql.MySqlStatementExecuteEventArgs e) {               
progressBar1.Value = (int)(double)counter / all * 100;
counter++;
}
Basically, what you need is to wire to the MySqlStatementExecute event of MySqlScript.
Here you recalculate the progressBar.Value property and increment a row counter (counter++).
It's quite straight-forward, but if you have any questions just go ahead.
Alexey.mdr
 
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Postby Zero-G. » Wed 09 Apr 2008 10:10

Hey

PERFECT - Thanks!

I gonna try this out.

One more question. - How many statements can I load into a Script?

I have about 20000 Statements to read out from 3 files and put it into the server. - Now I do use 3 mySQLScripts. Would it be possible to use only 1 Script?

thx
Zero-G.
 
Posts: 390
Joined: Sat 09 Dec 2006 12:20

Postby Alexey.mdr » Wed 09 Apr 2008 11:21

mySqlScript.Statements.Capacity has returns an Int32 value.
Thus there may be up to 2,147,483,647 statements.
So no problem, you can use one MySqlScript component.
Alexey.mdr
 
Posts: 729
Joined: Thu 13 Dec 2007 10:24


Return to dotConnect for MySQL