Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connect to Crystal Report Viewer

Status
Not open for further replies.

llmclaughlin

Programmer
Aug 20, 2004
140
US
I created a crystal report within VB.Net. My database server is not local, it connects fine when I'm designing the report, not the problem. The problem is when I put a viewer on a form and call it, I get a login form to connect to server. Which, doesn't work when I enter the information. So, what needs to be done on the form where the viewer is so it will automatically connect to database.


Thanks

Louie
 
Private Sub Report_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo
Dim rptExpensiveProducts As New ReportDocument
rptExpensiveProducts.Load("..\Klanten.rpt")

' Set the connection information for all the tables used in the report
' Leave UserID and Password blank for trusted connection
For Each tbCurrent In rptExpensiveProducts.Database.Tables
tliCurrent = tbCurrent.LogOnInfo
With tliCurrent.ConnectionInfo
.ServerName = ServerName
.UserID = ""
.Password = ""
.DatabaseName = ConfigurationSettings.AppSettings.Get("DataBase")
End With
tbCurrent.ApplyLogOnInfo(tliCurrent)
Next tbCurrent
CrystalReportViewer1.ReportSource = rptExpensiveProducts
'CrystalReportViewer1.Zoom(2)
End Sub


Eric De Decker
eric.de.decker@pandora.be

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top