i have created a web application in which a user can upload an excel file , the file when uploaded will get all the records from 1st column from the sheet1 and display all the email ids separated by a semi colon, then when the user clicks a "SAVE LIST" button all the emails ids will be saved in a table as an individual records. I have created the application, i want to know is there a way possible that while saving the records in the database a user is shown a progress bar .
Moreover is there any better way to insert so many records at a time.
code used to insert records from textbox separated by semi colon
string con = System.Configuration.ConfigurationManager.ConnectionStrings["emails"].ToString();
SqlConnection sconn = new SqlConnection(con);
StringBuilder text = new StringBuilder();
string[] a = TextBox1.Text.Split(';');
foreach (string em in a)
{
if (em != "")
{
text.Append("INSERT INTO ids VALUES ('");
text.Append(Session["compName"].ToString()); //Construct file name if needed...
text.Append("','");
text.Append(DropDownList1.SelectedValue.ToString()); //Construct file name if needed...
text.Append("','");
text.Append(em);
text.Append("') ");
}
}
sconn.Open();
SqlCommand scomm = new SqlCommand(text.ToString(), sconn);
scomm.ExecuteNonQuery();
sconn.Close();
Label1.Text = "E-Mails Succesfully Added";
TextBox1.Text = "";
http://i42.tinypic.com/1z2jfnq.jpg http://i43.tinypic.com/rarg5h.jpg http://i42.tinypic.com/bhn7g1.jpg