<pre> try
{
this.Cursor = Cursors.WaitCursor;
label1.Text = "Working...";
Application.DoEvents();
SqlConnection con = new SqlConnection(str);
con.Open();
SqlCommand cmd = new SqlCommand("Insert into Datatab(rfid) values (@rfid)", con);
cmd.Parameters.AddWithValue("@rfid", txtSwipe.Text);
cmd.ExecuteNonQuery();
con.Close();
txtSwipe.ResetText();
label1.Text = "Done";
}
catch (Exception ex)
{
label1.Text = "Error";
MessageBox.Show(ex.Message);
}
finally
{
this.Cursor = Cursors.Default;
}
int i;
progressBar1.Minimum = 0;
progressBar1.Maximum = 200;
for (i = 0; i <= 200; i++)
{
progressBar1.Value = i;
}