Solved

Crystal Reports 2016 Failed to open the connection Database Vendor Code 17, Error creating new data source

Posted on 2016-07-27
1
143 Views
Last Modified: 2016-07-29
Hi
 I'm trying to fix drilldown reports open connection failed error , this only appears on aspx.vb postbacks, either through page navigation or through drill down. Appreciate if you could help me resolve this issue.

 Regards,
 Member_2_7969420
CrystalReportError.png
0
Comment
Question by:Member_2_7969420
1 Comment
 
LVL 6

Accepted Solution

by:
Manju earned 500 total points
ID: 41733153
This is a common problem with embedding Crystal Reports in ASP pages. Essentially, the authentication details are reset on a postback and need to be reassigned in the Page_Init handler.

First, import these:

Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine

Open in new window


Then, in the Page_Init handler, re-apply connection info:

Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
Dim myReport As New ReportDocument()
myReport.Load(Server.MapPath("ReportName")) -- name of the crystal report

Dim myTables As Tables = myReport.Database.Tables

For Each myTable As CrystalDecisions.CrystalReports.Engine.Table In myTables
  Dim myTableLogonInfo As TableLogOnInfo = myTable.LogOnInfo
  myConnectionInfo.ServerName = "" -- <SQL servername>
  myConnectionInfo.DatabaseName = "" -- leave database name blank
  myConnectionInfo.UserID = "" -- username
  myConnectionInfo.Password = "" -- password
  myTableLogonInfo.ConnectionInfo = myConnectionInfo
  myTable.ApplyLogOnInfo(myTableLogonInfo)
Next

CrystalReportViewer1.ReportSource = myReport

Open in new window

0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now