locked
Getting a error like"Server name does not exist in context" For this code.Give some suggestions for this. RRS feed

  • Question

  •  

    private void ConfigureCrystalReports()

    {

     

    ReportDocument rpt=new ReportDocument();

     

    // string reportpath = Server.MapPath("CrystalReport1.rpt");

    rpt.Load(Server.MapPath(

    "C:\\Documents and Settings\\kaviyarasi-k\\My Documents\\Visual Studio 2005\\Projects\\crystalreport\\crystalreport\\CrystalReport1.rpt"));

     

    ConnectionInfo connectionInfo=new ConnectionInfo();

    connectionInfo.DatabaseName=

    "TestDB";

    connectionInfo.UserID=

    "sa";

    connectionInfo.Password=

    "ibs123$";

    SetDBLogonForReport(connectionInfo,rpt);

    crystalReportViewer1.ReportSource = rpt;

    }

    Monday, July 18, 2011 6:47 AM

All replies

  • either Remove the server.mappath() or specify a virtual address like server.mappath("crystalreport/CrystalReport1.rpt") if crystalreport is your root directory then server.mappath("CrystalReport1.rpt")

    because you are already specifying the physical address and server.mappath requires a virtual address as parameter and then it converts it into a physical address 


    --------------------------------------------------------

    Surender Singh Bhadauria

     

    • Proposed as answer by SAPDon Monday, July 18, 2011 2:54 PM
    Monday, July 18, 2011 11:45 AM