Print Page | Close Window

Open Connection is failing

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=6343
Printed Date: 18 May 2024 at 5:39am


Topic: Open Connection is failing
Posted By: snufse
Subject: Open Connection is failing
Date Posted: 13 May 2009 at 7:36am
I have an asp application that runs a Crystal Report (pull method). I dont't seem to get past error in my connection. I need the Crystal Report connect to different servers depending upon user selection. The data base and sign on are always the same. 
 
Here is my attempt:
 

Dim myPath As String = (Server.MapPath("PlantSalesReport.rpt"))

myCrystalReport1.Load(myPath)

myCrystalReport1.SetParameterValue("Ask-Date", DropDownList2.SelectedValue)

CrystalReportViewer1.ReportSource = myCrystalReport1

CrystalReportViewer1.Zoom(100)

CrystalReportViewer1.Width = 500

Dim myLogin As New ConnectionInfo

myLogin.ServerName = "RG5543"

myLogin.DatabaseName = "C:\Program Files\Astec Industries\WM2000\Data\WM2000DATA.add"

myLogin.UserID = "xxxx"

myLogin.Password = "yyyy"

Dim myTables As Tables = myCrystalReport1.Database.Tables

For Each myTable As CrystalDecisions.CrystalReports.Engine.Table In myTables

Dim myTableLogonInfo As TableLogOnInfo = myTable.LogOnInfo

myTableLogonInfo.ConnectionInfo = myLogin

myTable.ApplyLogOnInfo(myTableLogonInfo)

myTable.Location = myTable.LogOnInfo.TableName

Next

Now when I runn the app I get error:
 
Failed to open the connection. Failed to open the connection. C:\WINDOWS\TEMP\PlantSalesReport {64260EE9-7818-45DC-8D07-381284D2DEB8}.rpt
 
 



Print Page | Close Window