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

logon failed

Status
Not open for further replies.

emmanuelbeaudet

Programmer
Apr 16, 2002
51
0
0
CA
Have some reports (CR 9.0) that I open in vb6.
The database is on ms sql server ent. 2K.
If I run the report in crystal I have no problem.
When I try to open it in vb on get this message :

Logon failed.
Details:2800:[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'sirius'.

And as I said in crystal the same report has no problem.

Any solution ??


Thank you.

Emmanuel
 
Are you using SQL Server or Windows authentication? Regardless, you need to set the login information for the report object before it can connect to the database:
[tt]
Dim ConnectionInfo As CRAXDRT.ConnectionProperties
'Set the Connection Info to Connection Properties of the table object
Set ConnectionInfo = Report.Database.Tables(1).ConnectionProperties
'Set the ODBC DSN
ConnectionInfo.Item("DSN") = "DSNName"
'Set the database name
ConnectionInfo.Item("Database") = "Database name"
'Set the user name
ConnectionInfo.Item("User ID") = "UserName
'Set the password
ConnectionInfo.Item("Password") = "Password"
[/tt]
If you're using Windows authentication, you can ignore the Password property, and set the User ID property to "". Additionally, you may need to set the Integrated Security property (don't have CR9 to test right now):
[tt]
ConnectionInfo.Item("Integrated Security") = "True"
ConnectionInfo.Item("User Id") = ""
[/tt]
-dave
 
Using CR9 - I am getting the same error and have found this same code in the Crystal Knowledge Base. Unfortunately I dont get it.
Where am I suppose to write this code?

I understand I am getting this error due to writing this report in 8 and then updating to 9. I have many other reports I have done this to and I dont get the error. Does this have to do with having Sub-Reports?

Thanks for any information you can give
Michele

 
Private Sub Form_Load()
' connect to SQL Server Database
With Report.Database.Tables(1).ConnectionProperties
.Item("Provider") = "SQLOLEDB"
.Item("Data source") = sServer
.Item("Initial Catalog") = sDatabase
.Item("User ID") = sUsername
.Item("Password") = sPassword
End With

Report.DiscardSavedData 'required for consistent results that dont contain old data

Screen.MousePointer = vbHourglass
CRViewXRep.ReportSource = Report
CRViewXRep.ViewReport
Screen.MousePointer = vbDefault

End Sub
 
Was your report recently updated from CR8 or CR8.5 to CR9? Does it have Sub-reports, if so how many?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top