Solved

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

Posted on 2016-07-27
1
293 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

738 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