PDA

Click to See Complete Forum and Search --> : VB 2005 and Cystal reports


aerialz666
Jul 20th, 2007, 11:12 AM
Hi, im making a crystal report for my program and after setting it up and running it, it then asks me to login to the database where it is getting the data from, what codes should i add in order to skip this login prompt everytime i run the crystal report / form? thanks im using 05.

Asgorath
Jul 23rd, 2007, 08:15 AM
Hi.
Here's how to avoid login information prompt
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Dim crDatabase As Database
Dim crTables As Tables
Dim crTable As Table
Dim crTableLogOnInfo As TableLogOnInfo
Dim crConnectionInfo As ConnectionInfo

Dim crReportDocument As New CrystalReports1
crConnectionInfo = New ConnectionInfo
With crConnectionInfo
.ServerName = "Ares"
.DatabaseName = "Dinefer"
.UserID = "bb"
.Password = "aa"
End With
crDatabase = crReportDocument.Database
crTables = crDatabase.Tables
For Each crTable In crTables
crTableLogOnInfo = crTable.LogOnInfo
crTableLogOnInfo.ConnectionInfo = crConnectionInfo
crTable.ApplyLogOnInfo(crTableLogOnInfo)
Next

crReportDocument.PrintOptions.PaperOrientation = PaperOrientation.Landscape
crReportDocument.PrintOptions.PaperSize = PaperSize.PaperA4


CrystalReportViewer1.DisplayGroupTree = False

CrystalReportViewer1.Zoom(100)
CrystalReportViewer1.ReportSource = crReportDocument

shakti5385
Jul 23rd, 2007, 08:15 AM
Read crystal report tutorial at my signature!