Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > WinForms/Console Application Design
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the WinForms/Console Application Design section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 16th, 2009, 10:51 PM
Authorized User
 
Join Date: Aug 2006
Location: , , .
Posts: 20
Thanks: 4
Thanked 0 Times in 0 Posts
Default Crystal Reports Logon Failed

Hi,
I have developed an applicaion in vb.net which has a few crystal reports. I'm using MS Access database. Every thing is working fine on my development machine. But the logon failed error pops up on the deployment machine. I have googled for about a week now but to no avail. The code is as follows:

Code:
Dim crSections As Sections
Dim crSection As Section
Dim crReportObjects As ReportObjects
Dim crReportObject As ReportObject
Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo
Dim crSubreportObject As SubreportObject
Dim crSubreportDocument As ReportDocument
Dim crDatabase As Database
Dim crTables As Tables
Dim aTable As Table
Dim crTableLogOnInfo As TableLogOnInfo
Dim repDoc as new Result 'Result is the report doc .rpt
 
ForEach myTable In repDoc.Database.Tables
myLogin = myTable.LogOnInfo
myLogin.ConnectionInfo.Password = ""
myLogin.ConnectionInfo.UserID = "Admin"
myTable.ApplyLogOnInfo(myLogin)
Next
crSections = repDoc.ReportDefinition.Sections
'loop through all the sections to find all the report objects
ForEach crSection In crSections
crReportObjects = crSection.ReportObjects
'loop through all the report objects in there to find all subreports 
ForEach crReportObject In crReportObjects
If crReportObject.Kind = ReportObjectKind.SubreportObject Then
crSubreportObject = CType(crReportObject, SubreportObject)
'open the subreport object and logon as for the general report
crSubreportDocument = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName)
crDatabase = crSubreportDocument.Database
crTables = crDatabase.Tables
ForEach aTable In crTables
crTableLogOnInfo = aTable.LogOnInfo
crTableLogOnInfo.ConnectionInfo.UserID = "Admin"
crTableLogOnInfo.ConnectionInfo.Password = ""
'crTableLogOnInfo.ConnectionInfo.DatabaseName = Application.StartupPath & "\Taxi Training Software Db.mdb"
aTable.ApplyLogOnInfo(crTableLogOnInfo)
Next
EndIf
Next
Next
CrystalReportViewer1.ReportSource = repDoc


One thing i dont understand is what should i specify as Server name for Access DB.

Kindly, plz help me if u know whats wrong or if u know the solution to this problem.

Thanx
Reply With Quote
  #2 (permalink)  
Old January 17th, 2009, 08:42 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,190
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Hello. And did you try taking everything out?? why login to an access database that doesn't have a password nor an user?
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
Reply With Quote
  #3 (permalink)  
Old January 17th, 2009, 10:35 AM
Authorized User
 
Join Date: Aug 2006
Location: , , .
Posts: 20
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Even I cannot understand that. It does not have any username and password. I did not have the above code included before. It was working fine on my development machine. Even now it is. But on another system... I can't find a way to make it work. I am so fed up and stuck in this. What I am thinking now is that it might not be an issue with the database. It might be an issue with the crystal reports. Please HELP!!! this is urgent as my project is lingering on just because of this stupid error.
Reply With Quote
  #4 (permalink)  
Old January 19th, 2009, 11:36 AM
Authorized User
 
Join Date: Aug 2006
Location: , , .
Posts: 20
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Hi everyone,

I finally found out the solution to the problem myself.
Silly Errors are always the hardest ones to solve.
Same is the case over here.
As the Logon Dialog makes us all think that there's a great security issue associated with it, there isn't.

My mistake where i figured it out was that the report document uses the absolute full path of db included in the application.

So just modifying

Code:
ForEach myTable In repDoc.Database.Tables
myLogin = myTable.LogOnInfo
myLogin.ConnectionInfo.ServerName = Application.StartupPath & "\Db.mdb"
myLogin.ConnectionInfo.DatabaseName = Application.StartupPath & "\Db.mdb"
myTable.ApplyLogOnInfo(myLogin)
Next
solved my problem.
I totally ommitted the Username and password and instead provided the path to the db.

Hope it might help someone else who is also banging his/her head in front of the PC like i did for over a week....

Last edited by The Beginner; January 19th, 2009 at 11:41 AM.
Reply With Quote
  #5 (permalink)  
Old October 4th, 2010, 03:03 AM
Authorized User
Points: 30, Level: 1
Points: 30, Level: 1 Points: 30, Level: 1 Points: 30, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2008
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Crystal Reports Login

here is complete example

http://csharp.net-informations.com/c...amic-login.htm

Lee.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Crystal Report Logon failed mrleaps ASP.NET 1.0 and 1.1 Professional 1 October 13th, 2005 01:06 PM
Crystal Reports ActiveX Designer : Logon failed. thangna BOOK: Professional Crystal Reports for VS.NET 2 November 24th, 2004 05:37 AM
Crystal Reports ActiveX Designer Logon failed thangna Crystal Reports 1 November 11th, 2004 07:40 PM
crystal reports .net designer login failed error dilshan Crystal Reports 3 September 23rd, 2004 01:38 PM
Logon failed... exporting crystal reports into pdf JerBlur VB.NET 0 July 23rd, 2004 02:00 AM



All times are GMT -4. The time now is 09:55 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.