Insert more than 1 lakh records , show progress bar

Posted by Modit under ASP.NET on 11/14/2011 | Points: 10 | Views : 3090 | Status : [Member] | Replies : 1
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




Responses

Posted by: Ksuresh on: 11/15/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,
Using ASP.NET AJAX
How to display "Please wait .." message or "Progress Bar" image when loading the data from the server?

For Above Question Go through this link http://itfunda.com/Howto

Regards

Modit, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response