?
Solved

Crystal Reports-logon failed error

Posted on 2004-09-24
5
Medium Priority
?
1,404 Views
Last Modified: 2012-06-21
whenver i design a crystal report from within dot net environment, it gives me this error
CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed.
the code i have used is as follows:

Dim rpt As ReportDocument
        rpt = New ReportDocument
        CrystalReportViewer1.DataBind()
        rpt.Load("c:\inetpub\wwwroot\west\reports\rep1.rpt", OpenReportMethod.OpenReportByDefault)
        rpt.SetDatabaseLogon("sa", "123", "server1", "eastdb")
        CrystalReportViewer1.ReportSource = rpt
        CrystalReportViewer1.ShowFirstPage()
somebody please tell me, where i m wrong!!!
0
Comment
Question by:Heritagecomputer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 42

Expert Comment

by:frodoman
ID: 12142204
One thing about "SetDatabaseLogon" is that it only works if you're connecting to the same db that was used to design the report - if you're connection to another db (say a production vs. development) then this method will not work (ref: http://support.businessobjects.com/library/kbase/articles/c2013545.asp).

Otherwise the obvious thing is to check that the credentials are accurate - I don't see any problem with the code itself.

frodoman
0
 
LVL 42

Expert Comment

by:frodoman
ID: 12142210
If your report involves subreports then you may need a hotfix: http://support.businessobjects.com/library/kbase/articles/c2012317.asp

frodoman
0
 
LVL 1

Expert Comment

by:srini5474
ID: 12158467
this is no problem with your application, every time u newly connect/Edit Existing  DB using CrystalReporter... Do the following..................
Open ur Crystal reporter.
open field Explorer
Right click Database fields tree menu.
click on verify Database.
and click ok on following pop up windows. Ur DB will be refreshed..

i suppose ur problem should have been solved by now :-)

Regards
Srinivasan.S
0
 
LVL 10

Accepted Solution

by:
ebolek earned 750 total points
ID: 12160243
I use this code and it works try it
This code will help you.
private void setlogoninfo(CrystalDecisions.CrystalReports.Engine.ReportDocument myreport)
{
CrystalDecisions.Shared.TableLogOnInfo MyLogonInfo;
foreach(CrystalDecisions.CrystalReports.Engine.Table MyTable in myreport.Database.Tables)
{
MyLogonInfo = MyTable.LogOnInfo;
if (MyTable.Name == "")
{
MyLogonInfo.ConnectionInfo.UserID = this._username;
MyLogonInfo.ConnectionInfo.Password = this._password;
MyLogonInfo.ConnectionInfo.ServerName  = this._servername;  
MyLogonInfo.ConnectionInfo.DatabaseName = this._databasename ;              
{
else
{
               
MyLogonInfo.ConnectionInfo.UserID = this._username;
MyLogonInfo.ConnectionInfo.Password = this._password;
MyLogonInfo.ConnectionInfo.ServerName  = this._servername;  
MyLogonInfo.ConnectionInfo.DatabaseName = this._databasename ;
}
MyTable.ApplyLogOnInfo(MyLogonInfo);                    
MyTable.Location = MyTable.Location.Substring(MyTable.Location.LastIndexOf(".")+1);  
     
}
}          
Regards
Emre
0
 

Author Comment

by:Heritagecomputer
ID: 12890111
Thanks.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question