Data Connectivity
 Crystal Reports Forum : Crystal Reports .NET 2003 : Data Connectivity
Message Icon Topic: Connecting to database Post Reply Post New Topic
Author Message
vjain
Newbie
Newbie


Joined: 10 Oct 2008
Online Status: Offline
Posts: 3
Quote vjain Replybullet Topic: Connecting to database
    Posted: 21 Oct 2008 at 12:52am
Hi,
  I am working on VB and MS SQL, and generating reports using Crystal Reports 9. Working locally, I am able to configure the CR to connect to the local db.
Once the report is all done, and am sending it to the client, the database properties needs to be changed to the client's server details. Am using OLE DB for this. The client doesnt have CR 9 installed, so how do I change the db properties to the client's, and send it to the client, so that it can work.
 
I tried using the client's DataSource, UserID, etc, but it doesnt connect, maybe because of Firewall issues. Is there a way, where it can be coded? Or any other suggestions?
 
Thanks
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 05 Dec 2008 at 6:31am
If you are using .net, this will work as I use it and it runs fine.  Since you are using OLE.
Dim reportDoc As New CrystalDecisions.CrystalReports.Engine.ReportDocument

reportDoc.Load(strReportPath, CrystalDecisions.Shared.OpenReportMethod.OpenReportByTempCopy)

Try

''fb1888 RT 3/26/08 dynamically sets the datasource

Dim myDataSourceConnections As CrystalDecisions.Shared.DataSourceConnections = reportDoc.DataSourceConnections

Dim myConnectInfo As CrystalDecisions.Shared.IConnectionInfo = myDataSourceConnections(0)
myConnectInfo.SetConnection(SQLServer, Database, DatabaseUser, DatabasePassword)

CRViewer.ReportSource = reportDoc

CRViewer.Refresh()

Unfortunately, it requires knowledge of how the connection to the database is made...username, password, server, and database.

Hope this helps
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.047 seconds.