Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2016-07-27
1
Medium Priority
?
469 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 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

715 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