Print Page | Close Window

Can't connect to database

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Data Connectivity
Forum Discription: How to connect to data sources and export reports
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=712
Printed Date: 01 May 2024 at 7:18pm


Topic: Can't connect to database
Posted By: carlp22
Subject: Can't connect to database
Date Posted: 21 May 2007 at 1:54pm
 Hello All,

 With Visual Studio 2005, using VB, I have created a simple embeded Crystal report.  It only reads one Oracle table.

 I can't connect to the database! 

Here's the code I'm using.

Within a Windows form, I have a Crystal Reports Viewer (crvAllReports).  I'm  ODBC.

The form appears (no data of course), and after a couple of minutes, I get the error stating it can't connect to the database.
 
 What am I doing wrong?

 Thanks for the help,

Carl

 

 Dim crtableLogoninfos As New TableLogOnInfos()

Dim crtableLogoninfo As New TableLogOnInfo()

Dim crConnectionInfo As New ConnectionInfo()

Dim CrTables As Tables

Dim CrTable As Table

 

With crConnectionInfo

    .ServerName = "GoodName"

    .UserID = "Correct ID"

    .Password = "Correct Password"

End With

 

Dim sReport As New rptTest_2

CrTables = sReport.Database.Tables

 

'Loop through each table in the report and apply the

'LogonInfo information

For Each CrTable In CrTables

     crtableLogoninfo = CrTable.LogOnInfo

     crtableLogoninfo.ConnectionInfo = crConnectionInfo

     CrTable.ApplyLogOnInfo(crtableLogoninfo)

Next

 

crvAllReports.ReportSource = sReport




Print Page | Close Window