Link to home
Start Free TrialLog in
Avatar of brdrok
brdrok

asked on

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....
Avatar of BurntSky
BurntSky

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.
Avatar of brdrok

ASKER

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"/>
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?
Avatar of brdrok

ASKER

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...

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.
ASKER CERTIFIED SOLUTION
Avatar of MikeMCSD
MikeMCSD
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of brdrok

ASKER

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.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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. :/
Avatar of brdrok

ASKER

@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

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:

https://www.experts-exchange.com/questions/21188088/Crystal-Reports-and-ASP-NET-configuration-issue.html
Avatar of brdrok

ASKER

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.
Avatar of brdrok

ASKER

decided to go the pdf route.  reports come out pretty clean...except don't have functionality such as drill down...