[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 572
  • Last Modified:

Pleaseeeeee Help -- Bind ReportSource to CrystalReportViewer (VS.net2003 C# - Crystal Reports)

I need to bind a reportsource (already created .rpt), to a CrystalReportViewer. Programs:(VS.net2003 C# - Crystal Reports)
I have already read and followed the msdn instructions, but I think I am just in a panic.  I cannot seem to make this work.  
I started a new web project by using Asp.Net.WebApplication.  I now have forms Webform1.aspx and it's partner .cs.  I have added "Projects.rpt" to the project.  Webform1 now has the CrystalReportViewer, and I used the drag and drop for the oracleConnection.  How do I bind the Projects.rpt to the viewer?

The error I get is this:
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1010: Newline in constant

Source Error:

 

Line 12:       <body MS_POSITIONING="GridLayout">
Line 13:             <form id="Form1" method="post" runat="server">
Line 14:                   <CR:CRYSTALREPORTVIEWER id="CrystalReportViewer1" style="Z-INDEX: 101; LEFT: 80px; POSITION: absolute; TOP: 64px"
Line 15:                         runat="server" Height="1089px" Width="1030px" ReportSource='<%# C:\\Inetpub\\wwwroot\\NOV30_IMPACT\\Projects.rpt" %>' HasRefreshButton="True">
Line 16:                   </CR:CRYSTALREPORTVIEWER></form>
 

Source File: c:\inetpub\wwwroot\NOV30_IMPACT\WebForm1.aspx    Line: 14

=======================
It looks to me like I have the databinding language wrong.  I could really use some help here.  I am in a real bind! (No pun intended)
0
NeedInput
Asked:
NeedInput
  • 3
  • 2
  • 2
1 Solution
 
wimthepimscakeCommented:
Hi NeedInput,

I think ReportSource='<%# C:\\Inetpub\\wwwroot\\NOV30_IMPACT\\Projects.rpt" %>'
should be ReportSource="C:\Inetpub\wwwroot\NOV30_IMPACT\Projects.rpt"

Wimthepimscake
0
 
TheAvengerCommented:
I would say:

ReportSource=@"C:\Inetpub\wwwroot\NOV30_IMPACT\Projects.rpt"

or

ReportSource="C:\\Inetpub\\wwwroot\\NOV30_IMPACT\\Projects.rpt"

0
 
wimthepimscakeCommented:
if it is in the html/asp.net markup you have to use ReportSource="C:\Inetpub\wwwroot\NOV30_IMPACT\Projects.rpt"
if it is in C# syntax theAvenger is right

Wim
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
NeedInputAuthor Commented:
I tried the Avenger's suggestion to use: CrystalReportViewer1.ReportSource = @"C:\Inetpub\wwwroot\NOV30_IMPACT\Projects.rpt";

This at least got a different error.  Now the error is about the logon.  I have the logon listed in the "InitializeComponent" section, so maybe I have put the reportsource in the wrong place.  I put the report source in "private void Page_Load".  I have the connection that requires the logon associated with the report viewer.  Should I have put the reportsource somewhere else?
0
 
TheAvengerCommented:
No, it's not a problem of the place where you set the report source. What kind of logon does it require? Is it for the database? If so, the report cannot take the needed data because of different reasons. The most probable problem is that the ASPNET account (under which the IIS is running) does not have permissions on the database server
0
 
NeedInputAuthor Commented:
I made sure the properties under IIS for this folder were shared and had read and write permissions.  However, I still get an error.  In moving the report source to be after the passwords, I no longer get the logon error, but get an error that page will not load.  This is the code.  Maybe in seeing the whole thing, you might see what I am not seeing.

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Oracle.DataAccess.Client;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.Web;
using CrystalDecisions.CrystalReports;
using CrystalDecisions.Web.Services.Enterprise;
using CrystalDecisions.ReportSource;


namespace NOV30_IMPACT
{

      public class WebForm1 : System.Web.UI.Page
      {
            protected System.Data.OracleClient.OracleConnection oracleConnection1;
            protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer1;
            #region Web Form Designer generated code
            override protected void OnInit(EventArgs e)
            {
                  InitializeComponent();                  
                  base.OnInit(e);                  
                  DataBind();
                  this.CrystalReportViewer1.Visible = true;
                  this.CrystalReportViewer1.ReportSource= @"C:\Inetpub\wwwroot\NOV30_IMPACT\Projects.rpt";
            }
            
            private void InitializeComponent()
            {    
                  this.oracleConnection1 = new System.Data.OracleClient.OracleConnection();
                  //
                  // oracleConnection1
                  //
                  this.oracleConnection1.ConnectionString = "user id=user1;data source=ORACLEFILES;password=guest";
                  //      this.Load += new System.EventHandler(this.Page_Load);
                  this.CrystalReportViewer1.Visible = true;
                  this.CrystalReportViewer1.ReportSource = @"C:\Inetpub\wwwroot\NOV30_IMPACT\Projects.rpt";
            }
            #endregion
      }
}
0
 
TheAvengerCommented:
It's a problem in the database you are using (oracle if I see correctly), not in the folders. You should add rights for the ASPNET user in the database and all tables, stored procedures and other db objects taht are needed for the report.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now