Click here to Skip to main content
15,847,653 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionThe Domain Name System Pin
mnemonic6916-Apr-09 7:46
mnemonic6916-Apr-09 7:46 
AnswerRe: The Domain Name System Pin
Yusuf16-Apr-09 8:35
Yusuf16-Apr-09 8:35 
QuestionAbout Request.UrlReferrer Pin
Sundeep Ganiga16-Apr-09 7:05
Sundeep Ganiga16-Apr-09 7:05 
Questionhow we can veiw photo in graidview Pin
salahalnaggar16-Apr-09 6:57
salahalnaggar16-Apr-09 6:57 
AnswerRe: how we can veiw photo in graidview Pin
salahalnaggar16-Apr-09 7:00
salahalnaggar16-Apr-09 7:00 
GeneralRe: how we can veiw photo in graidview Pin
Yusuf16-Apr-09 8:36
Yusuf16-Apr-09 8:36 
AnswerRe: how we can veiw photo in graidview Pin
sara malik16-Apr-09 9:17
sara malik16-Apr-09 9:17 
QuestionSystem.OutOfMemoryException occured while writing data in Excel sheet Pin
abii55516-Apr-09 6:56
abii55516-Apr-09 6:56 
Hello Friends,

Urgent help required...

I am developing a Web Application using ASP.Net 2.0 and C#, my data base is ORACLE 9i. Previously everything was going right, but now as the data increases and the retrieving is become headache for me. Previously i was showing this data in the third party grid i.e. FARPOINT Spread. It happens with the spread too. so i write a program to convert the Generic List into excel sheet. This works fine on local (XP Professional 2 GB RAM and all) but once i deployed this application on the server (Win server 2003 12 GB RAM with 3GB Virtual Memory set and 500 GB HDD) it gives me error that 'System.OutOfMemoryException'.

I checked that data is coming till UI layer from Business layer but still why it is throwing error. Couldn't make it out. And i need solution for this ASAP.

Currently trying to write this fetched data in Excel sheet by using following code block.

Thanks in advance.

Code to write excel sheet -

private void FpLoadEditData(ArrayList userName, ArrayList siteId, string from, string to)

{

oXL = new Application();

oXL.Visible = false;

//Get a new workbook.

oWB = (_Workbook)(oXL.Workbooks.Add(System.Reflection.Missing.Value));

oSheet = (_Worksheet)oWB.ActiveSheet;

//System.Data.DataTable dtGridData = ds.Tables[0];

int iRow = 2;

// Setting Column name for Sheet

int colCount = QiSpread.ActiveSheetView.Columns.Count;

int colHeaderIndex = 1;

for (int j = 0; j < colCount; j++)

{

oSheet.Cells[1, j + 1] = ConfigurationSettings.AppSettings["colHead" + colHeaderIndex];

colHeaderIndex++;

}

for (int rowNo = 0; rowNo < vzmLst.Count; rowNo++)

{

//if (rowNo < 150)

//{

for (int colNo = 0; colNo < QiSpread.ActiveSheetView.ColumnCount; colNo++)

{

PopulateSheet(oSheet, iRow, colNo, vzmLst[rowNo]);

}

iRow++;

//}

//else

// rowNo = vzmLst.Count;

}

if (vzmLst.Count > 6000)

Session.Timeout = 15;

oRng = oSheet.get_Range("A1", "IV1");

oRng.EntireColumn.AutoFit();

oXL.Visible = false;

oXL.UserControl = false;

string strFile = string.Empty;

if (Request.Params.Get("__EVENTARGUMENT") != null &&

Request.Params.Get("__EVENTARGUMENT").ToString().ToUpper().Equals("EDITDATA"))

{

strFile = "VzMEditData_" + loginName + from + "TO" + to + "_" + DateTime.Now.Second.ToString() + ".xls";

//strFile = "VzMEditData" + from, to DateTime.Now.Ticks.ToString() + ".xls";

}

else if (Request.Params.Get("__EVENTARGUMENT") != null &&

Request.Params.Get("__EVENTARGUMENT").ToString().ToUpper().Equals("VIEWDATA"))

{

strFile = "VzMViewData_" + loginName + from + "TO" + to + "_" + DateTime.Now.Second.ToString() + ".xls";

}

//string strFile = "report" + DateTime.Now.Ticks.ToString() + ".xls";//+

oWB.SaveAs(strCurrentDir + strFile, XlFileFormat.xlWorkbookNormal, null, null, false, false, XlSaveAsAccessMode.xlShared, false, false, null, null, null);

// Need all following code to clean up and remove all references!!!

oWB.Close(null, null, null);

oXL.Workbooks.Close();

oXL.Quit();

Marshal.ReleaseComObject(oRng);

Marshal.ReleaseComObject(oXL);

Marshal.ReleaseComObject(oSheet);

Marshal.ReleaseComObject(oWB);

Session.Add("fileUrl", strFile);

}



To display the generated excel -

private void GetExcel()

{

if (Session["fileUrl"] != null && Session["fileUrl"].ToString() != string.Empty)

{

Response.ContentType = "application/vnd.ms-excel";

Response.AppendHeader("Content-Disposition", "attachment; filename=" + Session["fileUrl"].ToString());

Response.TransmitFile(Server.MapPath(".") + "\\EditViewDataFiles\\" + Session["fileUrl"].ToString());

HttpContext.Current.ApplicationInstance.CompleteRequest();

Response.Flush();

Response.Close();

}

}



Regards,

Abhijeet
AnswerRe: System.OutOfMemoryException occured while writing data in Excel sheet Pin
Colin Angus Mackay16-Apr-09 7:33
Colin Angus Mackay16-Apr-09 7:33 
AnswerRe: System.OutOfMemoryException occured while writing data in Excel sheet Pin
ToddHileHoffer16-Apr-09 7:51
ToddHileHoffer16-Apr-09 7:51 
QuestionPrint a Word document Pin
dptalt16-Apr-09 4:38
dptalt16-Apr-09 4:38 
AnswerRe: Print a Word document Pin
Abhijit Jana16-Apr-09 4:42
professionalAbhijit Jana16-Apr-09 4:42 
GeneralRe: Print a Word document Pin
dptalt16-Apr-09 5:14
dptalt16-Apr-09 5:14 
QuestionRe: Print a Word document Pin
led mike16-Apr-09 5:55
led mike16-Apr-09 5:55 
GeneralRe: Print a Word document Pin
Christian Graus16-Apr-09 12:57
protectorChristian Graus16-Apr-09 12:57 
AnswerRe: Print a Word document Pin
SeMartens16-Apr-09 4:42
SeMartens16-Apr-09 4:42 
GeneralRe: Print a Word document Pin
dptalt16-Apr-09 5:09
dptalt16-Apr-09 5:09 
GeneralRe: Print a Word document Pin
SeMartens16-Apr-09 5:12
SeMartens16-Apr-09 5:12 
GeneralRe: Print a Word document Pin
ToddHileHoffer16-Apr-09 5:12
ToddHileHoffer16-Apr-09 5:12 
GeneralRe: Print a Word document Pin
Arindam Tewary16-Apr-09 5:27
professionalArindam Tewary16-Apr-09 5:27 
GeneralRe: Print a Word document Pin
dptalt16-Apr-09 5:51
dptalt16-Apr-09 5:51 
GeneralRe: Print a Word document Pin
Arindam Tewary16-Apr-09 6:03
professionalArindam Tewary16-Apr-09 6:03 
GeneralRe: Print a Word document Pin
dptalt16-Apr-09 6:29
dptalt16-Apr-09 6:29 
GeneralRe: Print a Word document Pin
Christian Graus16-Apr-09 12:59
protectorChristian Graus16-Apr-09 12:59 
GeneralRe: Print a Word document Pin
ToddHileHoffer16-Apr-09 6:15
ToddHileHoffer16-Apr-09 6:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.