StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Crystal Reports \SF Connection InfoExpand / Collapse
Author
Message
Posted 11/30/2007 3:20:16 PM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 11/07/2008 5:12:40 AM
Posts: 150, Visits: 529
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

Post #12873
Posted 12/03/2007 8:56:31 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 10/21/2008 9:20:58 AM
Posts: 2,685, Visits: 1,887
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.


www.bungie.net
Post #12885
Posted 12/03/2007 4:04:15 PM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 11/07/2008 5:12:40 AM
Posts: 150, Visits: 529
Hey Ben,

I am getting a connection error,

Failed to open the connection.
Failed to open the connection.
C:\DOCUME~1\MICHAEL\LOCALS~1\Temp\rptSingleSubject

Post #12896
Posted 12/04/2007 11:20:00 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 5:33:19 PM
Posts: 4,771, Visits: 4,735
It sounds like your connection is not correct.  Were you sure to include the data base (Initial Catalog)?  If you ToString the SqlConnectionStringBuilder what does your connection string look like?  More than likely you are getting a valid error.
Post #12899
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 6:14pm

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.062. 11 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.