|
-
Jan 8th, 2010, 01:48 PM
#1
Thread Starter
Member
Db Connection to crystal report
Hi, I am using VS2008 and crystal reports that came shipped with it.
I am new at creating reports with crystal reports and also vs2008.
I have created a data source using the wizard to an MS Access DB which is password protected. Using this data source I have created a crystal report. The report runs just fine.
However, the end user might decide to put the database on the network. How do I change either my data source connection or crystal reports to access the database in its new location. I have tried now for almost two days also search various threads, but can’t seem to find a workable solution.
I possible, I would realy appreciate sample code.
Please help.
-
Jan 15th, 2010, 01:12 PM
#2
Re: Db Connection to crystal report
I use the next code to change the datasource, but it's an external rpt, hope it helps
Code:
Public CRReport As CrystalDecisions.CrystalReports.Engine.ReportDocument
Public CRTable As CrystalDecisions.CrystalReports.Engine.Table
Public CRTLI As CrystalDecisions.Shared.TableLogOnInfo
Code:
'
'code here
'
CRReport = New CrystalDecisions.CrystalReports.Engine.ReportDocument
CRReport.Load(GRptPath & "SATInvoice.rpt", CrystalDecisions.Shared.OpenReportMethod.OpenReportByTempCopy)
For Each CRTable In CRReport.Database.Tables
CRTLI = CRTable.LogOnInfo
With CRTLI.ConnectionInfo
.ServerName = "MyServer"
.UserID = "sa"
.Password = "B1Admin"
.DatabaseName = "Reports"
End With
CRTable.ApplyLogOnInfo(CRTLI)
Next CRTable
'
'code here
'
Last edited by jggtz; Jan 15th, 2010 at 01:18 PM.
-
Jan 22nd, 2010, 03:31 AM
#3
Thread Starter
Member
Re: Db Connection to crystal report
First I wish to apologise for only your post now only. I was out and could not get to my mail.
I have found a work around. I basically created a separate db without any security. I write the report data to this db at run time, and clean out the db when the report closes.
I would however love to try your code below. Cannot do it right now, but will let you know as soon as I have done so.
I appreciate you effort. Thanks
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|