Click here to Skip to main content
15,910,877 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, i am working on web application. I am using visual studio 2008 as ide and sql server 2005 as database. i used Microsoftreportviewer to print the report. it work fine at localhost but when it's uploded on server it shows the following error: Document is not found on the server. so plz anyone help me to short out this prblm.
i used the following code on (.cs) file

C#
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
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;


public partial class PrintCheckout : System.Web.UI.Page
{
    SqlConnection con = new SqlConnection();
    string conctn = ConfigurationManager.ConnectionStrings["con"].ConnectionString;
    SqlCommand com;
    string roomno = "";
    string id = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            roomno = Request.QueryString["RoomNo"];
            id = Request.QueryString["id"];
            this.ReportViewer1.LocalReport.DataSources.Clear();
            DataSet1 ds = new DataSet1(); // .xsd file name
            DataTable dt = new DataTable();
            con.ConnectionString = conctn;
            // Just set the name of data table
            dt.TableName = "Print Advance Report";
            dt = getAllOrders(); //This function is located below this function
            ds.Tables[0].Merge(dt);
            Microsoft.Reporting.WebForms.ReportDataSource rptDataSource = new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1_DataTable1", dt);
            this.ReportViewer1.LocalReport.DataSources.Add(rptDataSource);
            //this.ReportViewer1.LocalReport.ReportPath = Server.MapPath("Checkout.rdlc");

            this.ReportViewer1.LocalReport.Refresh();
        }
    }

    public DataTable getAllOrders()
    {
        con.ConnectionString = conctn;
        //SqlCommand cmd = new SqlCommand();
        DataSet ds = null;
        SqlDataAdapter adapter;
        try
        {
            ds = new DataSet();
            adapter = new SqlDataAdapter("select C.BillNo,dbo.GuestName(C.GuestID) as Name,convert(varchar(10),C.Date,103) as Date,convert(varchar(10),R.ArrivalDate,103) as ArrivalDate,R.ArrivalTime,convert(varchar(10),C.DepartureDate,103) as DepartureDate,C.DepartureTime,R.RoomRent,C.TotalRoomRent,C.RoomNo,E.NoOfPersons,C.LaundaryBill,C.FoodingBill,A.LuxuryTax,A.ServiceTax,A.ServiceCharges,A.AdvanceAmount,C.TotalDays,C.Refund,C.Total,C.GrandTotal,C.Discount,C.ExtraBedCharges,C.ExtraAmount from CheckOut C inner join Amount A on C.GuestID=A.GuestID inner join AllotRoom R on C.GuestID=R.GuestID inner join GuestEntry E on E.ID=C.GuestID where C.RoomNo='" + roomno + "' and C.GuestID='" + id + "'", con);
            adapter.Fill(ds);
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
        finally
        {
            //cmd.Dispose();
            //if (Con.State != ConnectionState.Closed)
                con.Close();
        }
        return ds.Tables[0];
    }
  
}
Posted
Updated 31-Jul-12 18:45pm
v2
Comments
Member 8233601 1-Aug-12 0:55am    
error is shown in this line:this.ReportViewer1.LocalReport.DataSources.Add(rptDataSource);

1 solution

This is a huge code dump. What line has the error ? A file is missing, did you work out what line had the error, and verified that all the files you reference are actually where you expect ?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900