Click here to Skip to main content
15,907,913 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionTry Catch Pin
frostcox30-Nov-12 1:12
frostcox30-Nov-12 1:12 
AnswerRe: Try Catch Pin
Richard MacCutchan30-Nov-12 1:45
mveRichard MacCutchan30-Nov-12 1:45 
GeneralRe: Try Catch Pin
frostcox30-Nov-12 9:22
frostcox30-Nov-12 9:22 
GeneralRe: Try Catch Pin
Richard MacCutchan30-Nov-12 23:49
mveRichard MacCutchan30-Nov-12 23:49 
AnswerRe: Try Catch Pin
AmitGajjar1-Dec-12 2:34
professionalAmitGajjar1-Dec-12 2:34 
GeneralRe: Try Catch Pin
Robert Bettinelli3-Dec-12 15:20
Robert Bettinelli3-Dec-12 15:20 
GeneralRe: Try Catch Pin
frostcox5-Dec-12 8:42
frostcox5-Dec-12 8:42 
AnswerRe: Try Catch Pin
CommDev8-Dec-12 22:28
CommDev8-Dec-12 22:28 
Questionbest way to send bulk SMS Pin
Jassim Rahma30-Nov-12 1:01
Jassim Rahma30-Nov-12 1:01 
Questionhow to preview a word file before you download it? Pin
blachsmith29-Nov-12 22:59
blachsmith29-Nov-12 22:59 
QuestionCreating WCF client proxy using svcutil.exe Pin
indian14329-Nov-12 9:14
indian14329-Nov-12 9:14 
AnswerRe: Creating WCF client proxy using svcutil.exe Pin
AmitGajjar3-Dec-12 18:22
professionalAmitGajjar3-Dec-12 18:22 
QuestionCredit Card Processing using Paypal Pin
Rameez Raja28-Nov-12 21:15
Rameez Raja28-Nov-12 21:15 
AnswerRe: Credit Card Processing using Paypal Pin
Richard MacCutchan28-Nov-12 23:37
mveRichard MacCutchan28-Nov-12 23:37 
QuestionWeb Application Pin
jojoba201128-Nov-12 20:39
jojoba201128-Nov-12 20:39 
Questioniss problem in windoms xp Pin
ramukdin28-Nov-12 20:11
professionalramukdin28-Nov-12 20:11 
SuggestionRe: iss problem in windoms xp Pin
Richard MacCutchan28-Nov-12 23:36
mveRichard MacCutchan28-Nov-12 23:36 
Questioncontrols in ASP.Net Pin
vani1028-Nov-12 8:28
vani1028-Nov-12 8:28 
AnswerRe: controls in ASP.Net Pin
jkirkerx28-Nov-12 12:11
professionaljkirkerx28-Nov-12 12:11 
AnswerRe: controls in ASP.Net Pin
R. Giskard Reventlov28-Nov-12 12:21
R. Giskard Reventlov28-Nov-12 12:21 
AnswerRe: controls in ASP.Net Pin
CommDev8-Dec-12 22:32
CommDev8-Dec-12 22:32 
QuestionMicrosoft Office Excel cannot access the file Pin
umamahesh202027-Nov-12 23:52
umamahesh202027-Nov-12 23:52 
I am getting this while import and exporting data to Excel file

Quote:
Microsoft Office Excel cannot access the file 'C:\usr\SVN\ePROM\EffOnePMA\Files\QuestionStructure.xls'.

There are several possible reasons:
• The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same name as a currently open workbook.

Here I am Attacheing my code
private void DownLoadStrcture()
        {
            Excel.Application xlApp;
            Excel.Workbook xlWorkBook;
            Excel.Workbook xlTempWorkBook;
            Excel.Worksheet xlWorkSheet;
            Excel.Range range;
            range = null;
            int rCnt = 2;
            int cCnt = 2;
            string str;
            string fname = "QuestionStructure.xls";
            string Filepath = Server.MapPath("~/Files/" + fname);
            string TempFilename = "QuestionStructure_ " + Convert.ToInt32(Session[PageBase.SESSION_USER_ID]) + ".xls";
            string TempFilepath = Server.MapPath("~/Files/Temp/" + TempFilename);
            string dep = ddlDepartment.SelectedItem.Text.ToString();
            string area = ddlArea.SelectedItem.Text.ToString();
            string category = ddlCategory.SelectedValue != "-1" ? ddlCategory.SelectedItem.Text : "";
            string subCategory = ddlSubCategory.SelectedValue != "-1" ? ddlSubCategory.SelectedItem.Text : "";

            xlApp = new Excel.Application();
            xlWorkBook = xlApp.Workbooks.Open(Filepath, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
            xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
            range = xlWorkSheet.UsedRange;
            File.Copy(Filepath, TempFilepath);

            xlWorkBook.Close();
            xlApp.Quit();
            releaseObject(xlWorkSheet);
            releaseObject(xlWorkBook);
            releaseObject(xlApp);

            xlApp = new Excel.Application();
            xlTempWorkBook = xlApp.Workbooks.Open(TempFilepath, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
            xlWorkSheet = (Excel.Worksheet)xlTempWorkBook.Worksheets.get_Item(1);
            range = xlWorkSheet.UsedRange;

            str = (string)(range.Cells[rCnt, cCnt] as Excel.Range).Value2;
            string[] stringArray = new string[] { dep, area, category, subCategory };
            for (int i = 0; i < stringArray.Length; i++)
            {
                (range.Cells[rCnt, cCnt] as Excel.Range).Value2 = stringArray[i].ToString();
                str = (string)(range.Cells[rCnt, cCnt] as Excel.Range).Value2;
                rCnt++;
            }
            xlApp.DisplayAlerts = false;
            xlApp.ScreenUpdating = false;
            xlApp.Visible = false;
            xlApp.UserControl = false;
            xlApp.Interactive = false;
            string Deletefilepath = Server.MapPath("~/Files/Temp/");
            if (File.Exists(Deletefilepath + TempFilename))
                File.Delete(Deletefilepath + TempFilename);

            xlTempWorkBook.Close(SaveChanges: true);
            Marshal.ReleaseComObject(xlTempWorkBook);
            xlApp.Quit();
            GC.Collect();
            GC.WaitForPendingFinalizers();
            Marshal.FinalReleaseComObject(xlTempWorkBook);
            Marshal.FinalReleaseComObject(range);
            Marshal.FinalReleaseComObject(xlApp);
            
        }

QuestionhttpModule Type Language Module will not load in Visual Studio debugger Pin
Raimundo2a27-Nov-12 22:50
Raimundo2a27-Nov-12 22:50 
AnswerRe: httpModule Type Language Module will not load in Visual Studio debugger Pin
Richard MacCutchan28-Nov-12 0:10
mveRichard MacCutchan28-Nov-12 0:10 
GeneralRe: httpModule Type Language Module will not load in Visual Studio debugger Pin
Raimundo2a28-Nov-12 4:16
Raimundo2a28-Nov-12 4:16 

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.