Click here to Skip to main content
15,909,530 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionDropdownlist selected index changed event not firing Pin
JacquesDP13-Dec-07 23:28
JacquesDP13-Dec-07 23:28 
GeneralRe: Dropdownlist selected index changed event not firing Pin
Sun Rays13-Dec-07 23:30
Sun Rays13-Dec-07 23:30 
GeneralRe: Dropdownlist selected index changed event not firing Pin
JacquesDP13-Dec-07 23:44
JacquesDP13-Dec-07 23:44 
Generaluploading files from visual web developer express edition Pin
eyeseetee13-Dec-07 22:55
eyeseetee13-Dec-07 22:55 
GeneralRe: uploading files from visual web developer express edition Pin
Abhijit Jana13-Dec-07 23:07
professionalAbhijit Jana13-Dec-07 23:07 
GeneralRe: uploading files from visual web developer express edition Pin
eyeseetee13-Dec-07 23:19
eyeseetee13-Dec-07 23:19 
QuestionDynamically Creating controls in UserControl at design time Pin
fieh13-Dec-07 22:51
fieh13-Dec-07 22:51 
GeneralUsing Excel And Doc file into Web Server Pin
Deepak the Cool13-Dec-07 21:55
Deepak the Cool13-Dec-07 21:55 
Hello EveryOne

I want to use Excel file into my web project.So I add reference and use it.

It is run properly into My localHost but when I upload this site into my web server it is not running properly.

And showing following error :

“Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154”

And My method is following which is create the Excel Sheet.....

private void createDataInExcel(DataTable dt)
{
Excel.Application oXL;
Excel._Workbook oWB;
Excel._Worksheet oSheet;
Excel.Range oRng;
string strCurrentDir = Server.MapPath(".") + "\\reports\\";
try
{
oXL = new Excel.Application();
oXL.Visible = false;
oWB = (Excel._Workbook)(oXL.Workbooks.Add(System.Reflection.Missing.Value));
oSheet = (Excel._Worksheet)oWB.ActiveSheet;
int intdsCount = dt.Rows.Count;
int iRow = 2;
if (dt.Rows.Count > 0)
{
for (int j = 0; j < dt.Columns.Count; j++)
{
string a = dt.Columns[j].ColumnName;
oSheet.Cells[1, j + 1] = dt.Columns[j].ColumnName;
}
// For each row, print the values of each column.
for (int rowNo = 0; rowNo < dt.Rows.Count; rowNo++)
{
for (int colNo = 0; colNo < dt.Columns.Count; colNo++)
{
oSheet.Cells[iRow, colNo + 1] = dt.Rows[rowNo][colNo].ToString();
}
iRow++;
}
}
oSheet.get_Range("A1", "IV1").Font.Bold = true;
oRng = oSheet.get_Range("A1", "IV1");
oRng.EntireColumn.AutoFit();
oXL.Visible = false;
oXL.UserControl = false;
FileInfo[] files=new DirectoryInfo(Server.MapPath("~\\Admin\\reports\\")).GetFiles("*.xls");
check_login();
string strUserName = Session["UserName"].ToString();
string strFile = String.Concat(strUserName, "_" , "report" , System.DateTime.Now.Ticks.ToString() , ".xls");
foreach(FileInfo fi in files)
{
string[] arrFileInfo = fi.ToString().Split('_');
if (arrFileInfo[0].ToString() == strUserName)
{
if (fi.ToString().Trim() != strFile)
{
fi.Delete();
}
}
}
oWB.SaveAs(strCurrentDir + strFile, Excel.XlFileFormat.xlWorkbookNormal,
null, null, false, false, Excel.XlSaveAsAccessMode.xlShared, false, false, null, null, null);
oWB.Close(null, null, null);
oXL.Workbooks.Close();
oXL.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(oRng);
System.Runtime.InteropServices.Marshal.ReleaseComObject(oXL);
System.Runtime.InteropServices.Marshal.ReleaseComObject(oSheet);
System.Runtime.InteropServices.Marshal.ReleaseComObject(oWB);
string displayScript = "<script language='javascript'>" +
" winOpen('ExcelSheet.aspx?ExcelFile=" + strFile + "')" +
" </script>";
Page.RegisterStartupScript("PopupScript", displayScript);
}
catch (Exception theException)
{
Response.Write(theException.Message);
}
}

Thnax and regards
Deepak

Smile | :) Smile a Lots,Its Costs Nothing

GeneralAnalysis chart Pin
SUDHAKAR PALLAM13-Dec-07 21:06
SUDHAKAR PALLAM13-Dec-07 21:06 
GeneralRe: Analysis chart Pin
Vasudevan Deepak Kumar13-Dec-07 21:36
Vasudevan Deepak Kumar13-Dec-07 21:36 
GeneralUnable to cast object of type 'System.Byte[]'to 'System.IConvertible'. in Uploadiong Image in to Sqlserver Pin
mrgaddam13-Dec-07 20:48
mrgaddam13-Dec-07 20:48 
AnswerRe: Unable to cast object of type 'System.Byte[]'to 'System.IConvertible'. in Uploadiong Image in to Sqlserver Pin
Guffa13-Dec-07 21:11
Guffa13-Dec-07 21:11 
GeneralRe: Unable to cast object of type 'System.Byte[]'to 'System.IConvertible'. in Uploadiong Image in to Sqlserver Pin
mrgaddam13-Dec-07 21:43
mrgaddam13-Dec-07 21:43 
GeneralRe: Unable to cast object of type 'System.Byte[]'to 'System.IConvertible'. in Uploadiong Image in to Sqlserver Pin
Guffa13-Dec-07 21:50
Guffa13-Dec-07 21:50 
Questionhow i can check wheter the text enterd is in a data formate or not Pin
jagan12313-Dec-07 20:28
jagan12313-Dec-07 20:28 
AnswerRe: how i can check wheter the text enterd is in a data formate or not [modified] Pin
Tarun Dudhatra14-Dec-07 1:05
Tarun Dudhatra14-Dec-07 1:05 
General3 level drill down datagrid Pin
uglyeyes13-Dec-07 20:00
uglyeyes13-Dec-07 20:00 
GeneralRe: 3 level drill down datagrid Pin
uglyeyes15-Dec-07 12:31
uglyeyes15-Dec-07 12:31 
GeneralInvalidOperationException was unhandled by user code Pin
Elizma13-Dec-07 19:35
Elizma13-Dec-07 19:35 
GeneralRe: InvalidOperationException was unhandled by user code Pin
N a v a n e e t h13-Dec-07 19:43
N a v a n e e t h13-Dec-07 19:43 
GeneralRe: InvalidOperationException was unhandled by user code Pin
Elizma13-Dec-07 20:33
Elizma13-Dec-07 20:33 
GeneralRe: InvalidOperationException was unhandled by user code Pin
Paddy Boyd13-Dec-07 23:46
Paddy Boyd13-Dec-07 23:46 
QuestionCrystal Reports in ASP.NET 2005 Pin
zareee13-Dec-07 19:35
zareee13-Dec-07 19:35 
GeneralRe: Crystal Reports in ASP.NET 2005 Pin
Elizma13-Dec-07 21:22
Elizma13-Dec-07 21:22 
Generaldata manager class Pin
chithra.r13-Dec-07 19:32
chithra.r13-Dec-07 19:32 

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.