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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Login to 2 Database's

Status
Not open for further replies.

Luther1978

Technical User
Nov 13, 2002
74
GB
Using Visual Studio 2002 and Crystal I'm trying to build a report and interface which queries 2 databases, one on the SQL server and one local as an access database.

All works fine if I just run the report and login in to the SQL database letting the nasty Crystal dialogue boxes do the job. (The access database has no user account or password)

Using the Following code:
-----------------------------------------------------------
Dim crReportDocument As New ReportDocument()
Dim crTableLogonInfo As New TableLogOnInfo()
Dim crConnectionInfo As New ConnectionInfo()
Dim CrTables As Tables
Dim CrTable As Table

With crConnectionInfo
.ServerName = "HIGHWAYS"
.DatabaseName = "HIGHWAYS"
.UserID = "mking"
.Password = "password"
End With

crReportDocument = New LPM()
CrTables = crReportDocument.Database.Tables
For Each CrTable In CrTables
crTableLogonInfo = CrTable.LogOnInfo
If Not CrTable.Name = "TBL_AllRates" Then
crTableLogonInfo.ConnectionInfo = crConnectionInfo
CrTable.ApplyLogOnInfo(crTableLogonInfo)
Else
crTableLogonInfo.ConnectionInfo.ServerName = "HIGHWAYS"
crTableLogonInfo.ConnectionInfo.ServerName = "HIGHWAYS"
crTableLogonInfo.ConnectionInfo.UserID = ""
crTableLogonInfo.ConnectionInfo.Password = ""
End If

Next
Me.CrystalReportViewer1.ReportSource = crReportDocument
Me.Show()
---------------------------------------------------------

All works fine. Crystal doesn't ask for a login until I add the 2nd database to the linking Expert. As soon as I do this Crystal brings back its dialogue and asks for a password again, both to the SQL server table I'm linking to and the access database table, but any combination of my username and passwords, of which there isn't one for the access database doesn't let me in. (I have tried username "admin" for the access database too.)

Any help will be gratefully received.

Many Thanks

Martin King
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top