Crystal Reports \SF Connection Info


Author
Message
Michael Reese
Michael Reese
Advanced StrataFrame User (533 reputation)Advanced StrataFrame User (533 reputation)Advanced StrataFrame User (533 reputation)Advanced StrataFrame User (533 reputation)Advanced StrataFrame User (533 reputation)Advanced StrataFrame User (533 reputation)Advanced StrataFrame User (533 reputation)Advanced StrataFrame User (533 reputation)Advanced StrataFrame User (533 reputation)
Group: StrataFrame Users
Posts: 235, Visits: 1.6K
Can anyone help me with establishing a connection to SF at runtime. I keep getting an error using the Crystal "ConnectionInfo" with the SF "ConnectionString"

Thanks Much.

Sample code

******************************************************

Private Sub ConfigureCrystalReports()

Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()

myConnectionInfo.DatabaseName = "MYDB"

myConnectionInfo.UserID = "Test"

myConnectionInfo.Password = "1234"

myConnectionInfo.ServerName = "MYServer"

northwindCustomersReport = New ReportDocument()

Dim reportPath As String = Application.StartupPath & "\" & "SubjectReport.rpt"

northwindCustomersReport.Load(reportPath)

myCrystalReportViewer.ReportSource = northwindCustomersReport

SetDBLogonForReport(myConnectionInfo, northwindCustomersReport)

End Sub

Private Sub SetDBLogonForReport(ByVal myConnectionInfo As ConnectionInfo, ByVal myReportDocument As ReportDocument)

Dim myTables As Tables = myReportdocument.Database.Tables

For Each myTable As CrystalDecisions.CrystalReports.Engine.Table In myTables

Dim myTableLogonInfo As TableLogOnInfo = myTable.LogOnInfo

myTableLogonInfo.ConnectionInfo = myConnectionInfo

myTable.ApplyLogOnInfo(myTableLogonInfo)

Next

End Sub

Reply
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
What's the error you're getting?  It might be that you have to build the connection info like you are doing in your example, and to parse out the pieces of the connection string, you can use SqlConnectionStringBuilder.

Dim builder As New SqlConnectionStringBuilder(DataBasics.DataSources(String.Empty).ConnectionString)

The builder then has all the properties like DataSource, InitialCatalog, Username, Password, WindowsAuth, etc.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search