private void button2_Click(object sender, EventArgs e)
{
FbConnection Con = new FbConnection();
FbConnectionStringBuilder ConStrBuilder = new FbConnectionStringBuilder();
// ConnectionString bauen
ConStrBuilder.DataSource = "
localhost";
ConStrBuilder.UserID = "SYSDBA";
ConStrBuilder.Password = "masterkey";
ConStrBuilder.Database = "F:\\Test.fdb";
// ConnectionString zuweisen
Con.ConnectionString = ConStrBuilder.ConnectionString;
Con.Open();
FbCommand Cmd = new FbCommand();
Cmd.Connection = Con;
Cmd.Parameters.Add("Par1", FbDbType.Integer);
Cmd.Parameters.Add("Par2", FbDbType.Decimal);
Cmd.Parameters.Add("Par3", FbDbType.VarChar);
Cmd.Parameters.Add("Par4", FbDbType.TimeStamp);
Cmd.CommandText = "UPDATE OR INSERT INTO TEST (FELD1, FELD2, FELD3, FELD4) VALUES (@Par1, @Par2, @Par3, @Par4);";
Cmd.Prepare();
const int max = 10000;
progressBar1.Maximum = max;
progressBar1.Value = 0;
for (int i = 0; i < max; i++)
{
Cmd.Parameters["Par1"].Value = i;
Cmd.Parameters["Par2"].Value = i;
Cmd.Parameters["Par3"].Value = "Test";
Cmd.Parameters["Par4"].Value = DateTime.Now;
Cmd.ExecuteNonQuery();
progressBar1.Value = i;
label2.Text = i.ToString() + " / " + max.ToString();
Application.DoEvents();
}
}