Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 20th, 2006, 01:34 PM
Registered User
Join Date: Apr 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to lagyossarian
Default Problem executing code

I have an ASP.NET 2.0 web application. This application has a command button that triggers some code to happen. It works on my development box; but, when I deploy to my test server, it does not appear to execute. The page appears to just repost. I included some Response.Write statements to use for debugging and none of them are displaying on the reposted page. The code is posted below:

protected void btnExecute_Click(object sender, EventArgs e)
        String strPath;
        Microsoft.Office.Interop.Excel.Application objExcel = new Microsoft.Office.Interop.Excel.Application();
        Microsoft.Office.Interop.Excel.Workbook objWorkbook = null;
        Object missing = Type.Missing;

        if (Page.IsPostBack)
            Response.Write("Button clicked");
                connProviders.ConnectionString = SqlDataSource1.ConnectionString;
                SqlCommand cmdReports = new SqlCommand();

                cmdReports.Connection = connProviders;
                cmdReports.CommandType = CommandType.StoredProcedure;
                cmdReports.CommandText = "GetReports";

                SqlDataAdapter daReports = new SqlDataAdapter(cmdReports);
                DataSet dsReports = new DataSet("Reports");
                Response.Write("Fill dsReports");
                Response.Write("dsReports filled");

                foreach (ListItem l in lstProviders.Items)
                    if (l.Selected == true)
                        foreach (TreeNode pn in trvReports.Nodes)
                            foreach (TreeNode cn in pn.ChildNodes)
                                if (cn.Checked == true)
                                    foreach (DataRow d in dsReports.Tables[0].Rows)
                                        if (cn.Text == d["NodeName"].ToString())
                                            strPath = d["FileLocation"].ToString() + l.Text + @"\" + d["NodeName"].ToString() + @"\" + l.Text + " - " + d["ReportName"].ToString() + "." + d["ReportType"].ToString();
                                            if (File.Exists(strPath))
                                                    switch (d["ReportType"].ToString())
                                                        case "xls":
                                                            Response.Write("Made it to Excel Activation");
                                                            objWorkbook = objExcel.Workbooks.Open(strPath, 1, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing);
                                                            Response.Write("Opened Excel object");
                                                            objWorkbook.PrintOut(missing, missing, missing, missing, missing, missing, missing, missing);
                                                            Response.Write("Printed Excel object");
                                                catch (Exception DocEx)
                                                    MessageBox.Show("Problem with file " + strPath);
                                                    if (objWorkbook != null)
                                                        objWorkbook.Close(0, missing, missing);
            catch (Exception ex)

I'm fairly new to ASP.NET and am stuck. Any help/guidance is much appreciated. Thanks in advance.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems executing code Neal Access VBA 1 December 11th, 2006 04:07 AM
Problem executing code from Pro C# book leo05 General .NET 0 February 22nd, 2005 04:42 PM
Problem on executing code on server!! mkmaurya_it General .NET 0 February 11th, 2005 07:08 AM

All times are GMT -4. The time now is 06:14 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.