By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,883 Members | 2,037 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,883 IT Pros & Developers. It's quick & easy.

Trouble with Crystal Reports (embedded) accessing DB

P: n/a
I have installed a custom VB.Net app on a client's PC. It works fine except for Crystal Reports (surprise). Crystal refuses to connect to the database despite the fact that I specifically point it to the DB. Below is the code used to do this. The appropriate values are passed as global variables (and I have verified that they are the correct values). If anyone can tell me what I an doing wrong, please help!

'Changes the location of the database
Private Function GetTableLogOnInfo(ByRef rpt As CrystalDecisions.CrystalReports.Engine.ReportDocum ent) As Boolean
Dim myDbConn As New CrystalDecisions.Shared.ConnectionInfo()

With myDbConn
.ServerName = gstrCrystalDBServer
.DatabaseName = gstrCrystalDBDatabaseName
.UserID = gstrCrystalDBUserID
.Password = gstrCrystalDBPassword
End With

Dim myTableLogonInfo As New CrystalDecisions.Shared.TableLogOnInfo()
myTableLogonInfo = rpt.Database.Tables(0).LogOnInfo
myTableLogonInfo.ConnectionInfo = myDbConn
rpt.Database.Tables(0).ApplyLogOnInfo(myTableLogon Info)

Dim blnConnectionStatus As Boolean = rpt.Database.Tables(0).TestConnectivity()
If blnConnectionStatus Then
MessageBox.Show("Connection to database was successful!", "Crystal Reports DB Connection test", MessageBoxButtons.OK, MessageBoxIcon.Information)
Return True
MessageBox.Show("Connection to database FAILED!", "Crystal Reports DB Connection test", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Return False
End If
End Function
Jul 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.