Loading

Cannot load VB.NET Crystal Report on another SQL machine



Hi, this site has helped me a lot to improve my VB.NET programming. I need a further help. My VB.NET apps with backend as SQL 2008 run very very on my computer. I can run my forms on other machines also by attaching the SQL database. But I cannot run my crystal reports on other machines. It prompts for asking server name and database. Pls help how I can solve the problem. Thanks



renz09's picture

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim cryRpt As New ReportDocument
Dim crtableLogoninfos As New TableLogOnInfos
Dim crtableLogoninfo As New TableLogOnInfo
Dim crConnectionInfo As New ConnectionInfo
Dim CrTables As Tables
Dim CrTable As Table

cryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt")

With crConnectionInfo
.ServerName = "YOUR SERVER NAME"
.DatabaseName = "YOUR DATABASE NAME"
.UserID = "YOUR DATABASE USERNAME"
.Password = "YOUR DATABASE PASSWORD"
End With

CrTables = cryRpt.Database.Tables
For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrTable.ApplyLogOnInfo(crtableLogoninfo)
Next

CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
End Sub
End Class

thanks a lot

How can we increment alphanumeric values in VB.NET 2008? EG I want Emlpoyee ID as A-1, A-2, so on to load automatically on very new entry. I am using SQL 2008 as backend. Thanks

Add new comment