• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 695
  • Last Modified:

Crystal Report issues

Hello,

I am working with the Crystal Report that comes with Visual Studio .net.  I am having problems just making the page appear.

I put a CrystalReportViewer on a Webform.aspx, and when attmepting to navigate to that page, I get a "The Page cannot be Displayed" from my browser.

I noticed that the computer adds the following lines to the webconfig file after adding a report viewer on my page:
 <assemblies>
<add assembly="CrystalDecisions.CrystalReports.Engine, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.ReportSource, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Shared, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Web, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
</assemblies>

since those <add assembly> tags totally mess up my web app (i.e. can't even reach the login screen), I had to comment those lines out.

I am not sure whether this will help or not but this is in my page declaration after adding the report viewer

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

Any help would be greatly appreciated....

If there is something not quite clear...please feel free to ask away....
0
brdrok
Asked:
brdrok
  • 6
  • 5
  • 2
  • +1
2 Solutions
 
BurntSkyCommented:
You said you're getting a "The page cannot be displayed" message?  No server error message?  Are you running this locally?  Or on a remote machine?  Configure the application to give you the full server error page (including stack trace, etc.) and post that.
0
 
brdrokAuthor Commented:
heya...wish i could.  the server sits on a remote machine...and the "fine" folks at HQ love to clamp down on security to a point it's getting almost comical (i.e. no sql server on my machine, no iis, no permission to run triggers).

perhaps i didn't set my webconfig file correctly where it would display a more detailed message of the error.  below is my webconfig file:

    <customErrors mode="off" defaultRedirect="Errors.aspx"/>
0
 
BurntSkyCommented:
It's a little difficult to debug an error when you don't even know what the error is.  =)

Your web.config looks fine.  If you purposefully throw an error on another page does it give you the same "the page cannot be displayed" message?  Or do other pages show the server error message?

I assume this is a corporate project, so uploading files to another server is probably out of the question.  But if it's not, do you have somewhere else you can upload to where you would have more control?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
brdrokAuthor Commented:
i know...life is tough when one has to guess the error...but finally managed to sorta isolate the error.   =)

here is the code for my Page_Load event

SqlConnection m_cn;
DataSet m_ds;
SqlDataAdapter m_da;
string sql;

sql = "SELECT OrderID, AdvantageCode, Project.Name";
sql += " AS ProjectName, ESEProject, Tasks.Name ";
sql += " AS TaskName, DueDate, Client FROM Orders ";
sql += " INNER JOIN Tasks ON Tasks.TaskID = ";
sql += " Orders.TaskID INNER JOIN Project ON ";
sql += " Project.ProjectID = Orders.ProjectID WHERE ";
sql += " OrderID IN( (SELECT OrderStatus.OrderId ";
sql += " FROM OrderStatus GROUP BY ";
sql += " OrderStatus.OrderId HAVING COUNT(*) = 1 ";
sql += " AND OrderID IN (SELECT OrderStatus.OrderID ";
sql += " FROM OrderStatus WHERE StatusID = 2)))";

m_cn = new SqlConnection(@"Server=172.16.3.130;Database=SWOL2000;User ID=yechan;Password=swol2005;Trusted_Connection=False");
m_da = new SqlDataAdapter(sql, m_cn);
m_ds = new DataSet();
m_da.Fill(m_ds, "vw_CRTakenReport");

try
{
      CRTakenReport oRpt = new CRTakenReport();   //<----this line throwing exception
}
catch(Exception ex)
{
      //Server.Transfer("~/Errors.aspx");
      Response.Redirect("../Errors.aspx?msg=" + ex.Message, true);
}


turns out that the following line of code is being difficult:
CRTakenReport oRpt = new CRTakenReport();

The error message is as follows:
File or assembly name CrystalKeyCodeLib, or one of its dependencies, was not found

I really have no clue as to what they mena by that...

0
 
BurntSkyCommented:
Generally, that error message means the application references an assembly (.dll) that can't be found. Does your production machine have Crystal Reports installed? Try searching your dev machine for CrystalKeyCodeLib.dll and copy it over to the bin directory of your application on the server.
0
 
MikeMCSDCommented:
I think you have to create and run a setup and deployment package on the
server first, before you can use CR.NET.

http://dotnetjunkies.com/WebLog/richard.dudley/archive/2004/05/25/14449.aspx
0
 
brdrokAuthor Commented:
will look for it...what I probably should have mentioned is that assemblies/references relating to crystal such as:

CrystalDecisions.Shared
CrystalDecisions.CrystalReports.Engine
etc.

i set the property "Copy Local" from false to true.  not sure whether this has anyting to do with it.  but...at least that way I was able to at least generate the above mentioned error.
0
 
BurntSkyCommented:
MikeMCSD presents a more professional solution to the issue.  It would be a good idea to create a proper setup package for the application to make sure all the correct files are copied and registered on the production machine.  However, if you're limited on time or don't feel like making the setup package you should be able to copy the files you need over directly.

The "Copy Local" could definitely be part of the problem.  If you don't know what the property is for, it tells VS.NET whether or not to copy the assembly to your application's bin directory.  If the assembly was going to be installed in the GAC on any machine the application will be deployed to then you would set the "Copy Local" to false so you don't needlessly distribute additional copies of the .dll.  However, if your production machine does not have Crystal Reports installed or does not have the correct assemblies installed into the GAC and your application doesn't include them (e.g. if you set "Copy Local" to false) then the application will not run.
0
 
hendridmCommented:
Are you using IE?  If so, do you have "Use friendly HTTP error messages" turn on?  If so, that might be why you're not getting the server error. :/
0
 
brdrokAuthor Commented:
@hendrdm:
yes...got that option checked.

@burntSky and @MikeMCSD:
Ok...defn. seems to be the whole CR .runtime thingie issue.  Tried my code in a small windows app and it works like a charm but not in a web app.  Was hoping i could get away with copying all the assemblies relating to CR into my bin directory that sits on the web server.  I got the:

File or assembly name CrystalKeyCodeLib, or one of its dependencies, was not found

error message to disappear only to get a:

Cannot find KeycodeV2.dll, or invalid keycode.

message.  Not having access to that web server, is there anything I can do on my end here.  I probably will ask the admin guy to install the CR files onto the web server.  Problem is I am not exactly sure what to ask that guy.....any suggestions?

thanks

0
 
BurntSkyCommented:
0
 
MikeMCSDCommented:
I had the same problem and received the same error messages as you did.

"Not having access to that web server, is there anything I can do on my end here."
My web site is hosted and I don't have access also.  I've been trying to get
CR.NET to run on it and finally just gave up.  I posted questions about this problem
3 times and it seems it can't be done. Setup/Deployment package is the best bet.
If you figure out how to get it going without a setup package, please let me know.
My solution was to write a CR Windows program and have it access the database
and produce the report.  But I have to install it on the client for it to work.
See if there is anything in this link that might help:

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/ASP_DOT_NET/Q_21188088.html
0
 
brdrokAuthor Commented:
sorry forgot to close the question....my head was spinning and i needed someone to stop the room =)

i won't spend any more time on this for right now but i would think that there ought to be some sort of a hack.  thanks for all your help and insight.
0
 
brdrokAuthor Commented:
decided to go the pdf route.  reports come out pretty clean...except don't have functionality such as drill down...
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 6
  • 5
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now