Hello,
This is Nitin,
I hope all of you are doing good. I liked this Website which helps us in solving problems.
Actually I have Problem regarding Excel file upload in ASP.NET 2.0.
Here I am uploading .CSV file on the server using File Upload. then we are reading the file and storing its data into the database(SQL database).
It works fine on test server but the same code on the production server crashes the website for long time.
can anybody knows the solution for this?
Here is the code.....
Excel.Application app = new Excel.ApplicationClass();
Excel.Workbook workBook = app.Workbooks.Open(pathfile, 0, true, 5, "", "", true,
Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
Excel.Worksheet workSheet = (Excel.Worksheet)workBook.ActiveSheet;
Excel.Range range = workSheet.get_Range("A1".ToString(),"A1".ToString());
String myvalues = Convert.ToString(range.Cells.Value2);
String[] moduleList = myvalues.Split(',');
range = workSheet.get_Range("A" + i.ToString(),"A" + i.ToString());
String myvalues2 = Convert.ToString(range.Cells.Value2);
string[,] strClient = new string[800, 2];
int n = 0;
while (myvalues2 != "" && myvalues2 != null && myvalues2 != " ")
{
range = workSheet.get_Range("A" + i.ToString(),"A" + i.ToString());
myvalues2 = Convert.ToString(range.Cells.Value2); //gets the entire "RECORD" of the student
if (myvalues2 == "")
{
goto result;
}
string[] studentGrades = myvalues2.Split(',');
i++;
string uin = studentGrades[1].ToString();