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

A CR XI and VB2005 Database Login issue

Status
Not open for further replies.
May 26, 2001
15
0
0
US
Greetings,

I have reviewed prior threads and to no avail. Here is the situation. I have developed two applications. Both use Access 2000 datbases, Visual Basic 2005, and Crystal Reports XI Developer edition.

Both applications use the same code. One application works, generating a report and the other pops up the 'Database Login' screen. I am new to the programming and obiviously this stumps the bits and bytes out of me.

Here is the code from the NON-working application.


Imports System.Configuration
Imports System
Imports System.ComponentModel
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Public Class frm_Report
Private r As ReportDocument

Private Sub Form3_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
loadreport()
End Sub

Sub loadreport()
r = New ReportDocument
r.Load(glbReportName)

Dim crConnectionInfo As New ConnectionInfo()
With crConnectionInfo
crConnectionInfo.ServerName = glbDatabaseName
crConnectionInfo.ServerName = glbRetirementDatabaseName
crConnectionInfo.ServerName = glbSupportDatabaseName
End With

Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo
For Each myTable In r.Database.Tables
myLogin = myTable.LogOnInfo
myLogin.ConnectionInfo = crConnectionInfo
myTable.ApplyLogOnInfo(myLogin)
Next
CrystalReportViewer1.SelectionFormula = glbSelectionFormula

CrystalReportViewer1.ReportSource = r
End Sub
End Class


Thanks for any pointers, comments, hints, or anything....
 
Given that the code works on one access database but not the other, it would seem that potentially the problem isn't the code.

As you're passing database login info to the script from global variables, could it be that the databases have different login information? - that would certainly explain the database login screen appearing (as the credentials you've supplied have failed, and the report is asking for different ones).

 
No, I have never used any type of login password. I don't know how to create them.

Any other ideas?
 
Hi

are you commenting out on of the

crConnectionInfo.ServerName = glbDatabaseName
crConnectionInfo.ServerName = glbRetirementDatabaseName
crConnectionInfo.ServerName = glbSupportDatabaseName

lines within the different versions - as i think this would just overwrite whichever you wanted with the last line.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top