Quantcast
Channel: Crystal Reports
Viewing all articles
Browse latest Browse all 1507

Error in Crystal Report

$
0
0

Hi,

I have a problem in my Crystal Report can't figure exactly.Here's the Code and MarkUp.Also can anyone say why is the crystal report .aspx page asking for Login Password and how to provide the details.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using CrystalDecisions.CrystalReports.Engine;

public partial class Shopping_PaymentReport : System.Web.UI.Page
{
    SqlConnection conn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=F:\Proj\BookStore.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
    DataSet ds = new DataSet();
    SqlDataAdapter adp;
    public static string billnum;
    store ss1 = new store();
    protected void Page_Load(object sender, EventArgs e)
    {
        ss1 = Session["data2"] as store;
        billnum = ss1.bino;
        LoginName ln = (LoginName)Master.FindControl("LoginName1");
        adp = new SqlDataAdapter("EXEC billDetailsOne @billno= " + billnum, conn);
        adp.Fill(ds, "billDetailsOne");
        ReportDocument report = new ReportDocument();
        string reportpath = Server.MapPath("CrystalReport.rpt");
        report.Load(reportpath);
        report.SetDataSource(ds.Tables["billDetailsOne"]);
        CrystalReportViewer1.ReportSource = report;
    }
}

//MARKUP

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="PaymentReport.aspx.cs" Inherits="Shopping_PaymentReport" %>

<%@ Register Assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
    Namespace="CrystalDecisions.Web" TagPrefix="CR" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server"
        AutoDataBind="True" GroupTreeImagesFolderUrl="" Height="1202px"
        ReportSourceID="CrystalReportSource1" ToolbarImagesFolderUrl=""
        ToolPanelWidth="200px" Width="1104px" />
    <CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
        <report filename="CrystalReport.rpt">
        </report>
    </CR:CrystalReportSource>
</asp:Content>

///ERROR

Invalid object name 'PaymenyDetails'.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'PaymenyDetails'.

Source Error:

Line 22:         LoginName ln = (LoginName)Master.FindControl("LoginName1");
Line 23:         adp = new SqlDataAdapter("EXEC billDetailsOne @billno= " + billnum, conn);Line 24: adp.Fill(ds, "billDetailsOne"); Line 25:         ReportDocument report = new ReportDocument();
Line 26:         string reportpath = Server.MapPath("CrystalReport.rpt");


Source File: f:\Proj\BookStore\BookStore_Web\Shopping\PaymentReport.aspx.cs   Line:24

Stack Trace:

[SqlException (0x80131904): Invalid object name 'PaymenyDetails'.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +2073486
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5064444
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2275
   System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33
   System.Data.SqlClient.SqlDataReader.get_MetaData() +86
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +311
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +987
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
   System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141
   System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12
   System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +10
   System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +144
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +319
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +92
   Shopping_PaymentReport.Page_Load(Object sender, EventArgs e) in f:\Proj\BookStore\BookStore_Web\Shopping\PaymentReport.aspx.cs:24
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +91
   System.Web.UI.Control.LoadRecursive() +74
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207


Viewing all articles
Browse latest Browse all 1507

Trending Articles