Thursday, March 8, 2012

Crystal Report and Deployment

I have a winform application that I want to deploy.

It has a password protected Access database in the bin folder where it pulls all its information.
I have set up a crystal report to read the information and all works well when I am debugging it on my machine. Meaning it connects to the password protected database without asking what the server name, database name, or password was.

However when I deploy the application, if I click to view the crystal report, it opens a screen labeled Database Login. Asking for the Server Name, Database, Login ID and Password. However I don't want this box to pop up and just have the crystal report connect to the database deployed with the application.
The problem is that I think it is trying to look in the folder that the database was in on the computer I was developing it on.

I connnect to the database like so for the crystal report

Dim crpt_Attendance As New Attendance
Dim myTable As CrystalDecisions.CrystalReports.Engine.Table

Dim Login As CrystalDecisions.Shared.TableLogOnInfo

For Each myTable In crpt_Attendance.Database.Tables
Login = myTable.LogOnInfo
Login.ConnectionInfo.Password = "RTr@.k"
Login.ConnectionInfo.UserID = ""
myTable.ApplyLogOnInfo(Login)
Next

crptv_Attendance.ReportSource = crpt_Attendance

I have included the Access Database in the Application folder when I deploy it. And before I create the report, I have a datagrid that reads the information from this database. So I don't know why the crystal report is looking at the location from the computer I created it on and not in the application folder.

Any help is greatly appreciated as I am not very familiar with crystal reports!Make sure you don't have the Database Path hardcoded somewhere in VB or Crystal.|||I only have CR 8.5 developer, but in it you have to set the .ReportSource and you can specify the .SetLogOnInfo.
oReport.Database.Tables(1).SetLogOnInfo sServer, sDatabase, sUserName, sUserPwd

No comments:

Post a Comment