Page 1 of 1
Script & Progressbar
Posted: Tue 08 Apr 2008 14:20
by Zero-G.
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
Posted: Wed 09 Apr 2008 10:00
by Alexey.mdr
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.
Posted: Wed 09 Apr 2008 10:10
by Zero-G.
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
Posted: Wed 09 Apr 2008 11:21
by Alexey.mdr
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.