cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to open connection

Former Member
0 Kudos

Dear all,

I am creating a web application which run in a server and just launch the Report viewer to display a Crystal Report.

Basically I create a button which allow the user to Manually update the report.

I am pretty newbie in this kind of stuff and maybe can be something which I am missing, unfortunately I cannot find any references to this tedious error.

When I launch the website everything works, but when I press the update button I receive the error

Failed to open the connection. Failed to open the connection. one {83147855-5903-4A2A-9E8A-9A385574741B1}.rpt

Here there is the manually update button code

  protected void Button1_Click(object sender, EventArgs e)

    {

       

        CrystalReportViewer1.RefreshReport();

        Label1.Text = "Update Manually at " + DateTime.Now.ToString("dd/mm/yyyy HH:mm:ss");

    }

}

Thanks in advance

Luca

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

Hi Luca

Difficult to say as there is not enough information here. Two possibilities come to mind though:

Looks like when you run the report 1st time, it is not hitting the database and instead it is using "Saved Data". On refresh, the report attempts to connect to the database and as there is no code telling it how to do that it fails.

Alternatively, this being a web app (assumption as you mention "server"), you have logon code in your app, but the report is not in session. On refresh there is a post back and all logon info is lost.

For logon code see the sample app vbnet_win_dbengine here: Crystal Reports for .NET SDK Samples - Business Intelligence (BusinessObjects) - SCN Wiki

Also, see the Dev Help files:

SAP Crystal Reports .NET SDK Developer Guide

SAP Crystal Reports .NET API Guide

For session code see:

KBA: 1985571 - How to use sessions in web applications using the Crystal Reports viewer (the complete cod...

If the issue still persists after doing the above, see if searching the SCN will help (search box is in top right corner). And, do provide more info:

Version of CR used (precise)

Version of .NET

Database

Version of database client

OS

Code

etc. etc. The more info, the better...

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter

Former Member
0 Kudos

Hi Ludek,

first of all thank you very much for this reply an even for posting the helpful guide about the Assembly/GAC error on the server.  (I read and literally eat it and was very helpful).


I have indeed developed an ASP.NET website in C# using Visual Studio 2013.And it is very simple.

The database is internal on the company and in general (to create report and make the connection I use  ODBC) and use Window authentication.

I created a WebFrom (Default.aspx) which contain a Crystal Report. I inserted the CRViewer linked to the report and inserted an update button (above the code).

The problem (maybe due to my ignorance on it) is that on my developing machine the report seems to update and refresh ( anyway no message error is displayed) but when i deploy it on my Server (which has Windows XP SP3) I receive the above error message after the update.

I have the feeling that as you said "you run the report 1st time, it is not hitting the database and instead it is using "Saved Data", this is the problem. I will focus on it and I will read the docs you posted letting you know if I have still problem.

Hope my info are sufficient.

Thank you so much

Luca

 

former_member183750
Active Contributor
0 Kudos

Hi Luca

You mention that the OS is Windows XP. Looking at the Supported Platforms for SAP Crystal Reports, Developer Version for Visual Studio .NET, Win XP is not there as a supported OS:

So, you're in one of those situations where this may or may not work and figuring out why / why not is a devilish exercise in frustration. Perhaps utilities such as Fiddler and Process Monitor (perhaps even Modules) may help, but best option is to move to a supported OS.

- Ludek

Former Member
0 Kudos

Hi Ludek,

Thanks again for the support but I am not sure if that is right (Iwill ask to the IT support to upgrade the OS though).

I am currently developing in Visual Studio 2010 only my server is based on Windows XP SP3.

The .NET Framework which I am using is 4 and even the assemblies works fine.

Now I add the odbc to the Server and the error (Failed to open a connection{}).rpt is not shown anymore.

I think though that what you said in your first post is almost exactly: in brief in my application i set up just a report but I am not creating any istance to the Database (ODBC) which is internal at the company where I work.

In my Default.aspx on the Page_Load and on my "UpdateButton_Click" I am now passing the credential via the method reportDocument.SetDatabaseLogon("user", "password", "server", "database"); 

A quick question : do I need an istance of my odbc in my Default.aspx page?

The problem is that when i ran my webpage on the server it throwns me the window asking those credentials, even though "user","password","server","database" are set correctly on that page.

By chance there is a guide where I can find how set up a web page in asp.net which have crystal report? the only ones I have found on the web are based in ADO.net dataset which is not my case.

Thank you very much

Best Regards

Luca

former_member183750
Active Contributor
0 Kudos

Hi Luca

Re: A quick question : do I need an instance of my odbc in my Default.aspx page?

No you do not. Using the SetDatabaseLogon shold work fine. If you will be changing to a different ODBC datasource or changing database or tables, you will have to use .ApplyLogonInfo. You can see a sample app of this here:

Crystal Reports for .NET SDK Samples - Business Intelligence (BusinessObjects) - SCN Wiki

(vbnet_win_dbengine.zip / csharp_win_dbengine)

As for a guide on setting up a web page. There really is nothing more to it than deploying the app as you would any web app. Usual configuration issue comes in with the viewer having problems displaying the report, not a database logon.

Umm, one more thing. There is actually a utility that will write the logon code for you that you may be interested in. See KBA - 1553924: Is there a utility that would help in writing database logon code?

- Ludek

Message was edited by: Ludek Uher

Answers (0)