Error 2 'System.Web.HttpApplicationState' does not contain a definition for 'startuppath' and no extension method 'startuppath' accepting a first argument of type 'System.Web.HttpApplicationState' could be found (are you missing a using directive or an assembly reference?) E:\Report1\global\Default.aspx.cs 77 36 E:\Report1\global\

please help me..
i want to override the connection string of crystal reports which was connected by the database experts..
now i want to override with with new connection string .. the above error is diaplaying..
the following is my code if there is any mistake please correct me...
its urgent please help me....

the code is..

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System.Data.OleDb;
using CrystalDecisions.Enterprise;

public partial class _Default : System.Web.UI.Page
    string connections = ConfigurationManager.ConnectionStrings["SqlConn"].ConnectionString;
    private TableLogOnInfo LogInfo = new TableLogOnInfo();
    protected void Page_Load(object sender, EventArgs e)
        if (!IsPostBack)




    private void SetLogonInfo()
            LogInfo.ConnectionInfo.ServerName = "";
            LogInfo.ConnectionInfo.UserID = "";
            LogInfo.ConnectionInfo.Password = "";
            LogInfo.ConnectionInfo.DatabaseName = "";
        catch (Exception e)
    //private void setDBLOGONforREPORT(ConnectionInfo myconnectioninfo)
    //    TableLogOnInfos mytableloginfos = new TableLogOnInfos();
    //    mytableloginfos = CrystalReportViewer1.LogOnInfo;
    //    foreach (TableLogOnInfo myTableLogOnInfo in mytableloginfos)
    //    {
    //        myTableLogOnInfo.ConnectionInfo = myconnectioninfo;
    //    }


      protected void btn_emp_Click(object sender, EventArgs e)
        // string connections = ConfigurationManager.ConnectionStrings["SqlConn"].ConnectionString;
        // string connections = "Data Source=VSSPL-002\\SQLEXPRESS;Initial Catalog=employee;Integrated Security=True";
        string myQuery = "select * from employee";
        SqlConnection myConnection = new SqlConnection(connections);
        SqlCommand myCommand = new SqlCommand(myQuery, myConnection);
        SqlDataAdapter da = new SqlDataAdapter(myCommand);
        DataSet dt = new DataSet();
        DataTable td = dt.Tables[0];
         ReportDocument myreport = new ReportDocument();
         string path = Application.startuppath + "~/" + "emp.rpt";
         CrystalReportViewer1.ReportSource = myreport;
          // myreport.Load(MapPath("~/" + "emp.rpt"));
         //CrystalReportViewer1.ReportSource = myreport;
         //int count = Convert.ToInt32(dt.Tables[0].Rows.Count);

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

8 Years
Discussion Span
Last Post by Vigneshjvm
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.