Solved

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

Posted on 2016-07-27
1
112 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

744 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

11 Experts available now in Live!

Get 1:1 Help Now