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!

Login failed on SQL Server using Crystal Reports

Status
Not open for further replies.

jmerencilla

Programmer
Jul 17, 2002
123
0
0
SG
hi. i made a simple crystal report on a web app. however, everytime i run my app it displays the error below. i made the necessary connections (with valid sa account and password) at design time and i can fairly say that there is no error on this stage. though the connection is correct at design time, i get this error at run time. it seems that i was not able to connect to the database at run time. is there a way to preserve the sa and password so that i won't get this error each time i run my page? also, how will i do this if i am to use an Oracle database? thanks. :)


Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:


[LogOnException: Logon failed.]
.K(String 
, EngineExceptionErrorID  )
.F(Int16 , Int32 )
.E(Int16 )
CrystalDecisions.CrystalReports.Engine.FormatEngine.GetPage(PageRequestContext reqContext)
CrystalDecisions.ReportSource.LocalReportSourceBase.GetPage(PageRequestContext pageReqContext)
CrystalDecisions.Web.ReportAgent.v(Boolean `)
CrystalDecisions.Web.CrystalReportViewer.OnPreRender(EventArgs e)
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Page.ProcessRequestMain()
 
Hi,
u have to logon to the server by giving the servername or ODBC source name, databasename, uid and Password for each table that is used in the design time of the crystal report...

Eg.,
Dim oRpt As New CrystalReports.Engine.ReportDocument()
oRpt.Load("c:\\first.rpt")

Dim i As Integer
Dim logonInfo As New CrystalDecisions.Shared.TableLogOnInfo()

For i = 0 To oRpt.Database.Tables.Count - 1
logonInfo = oRpt.Database.Tables(i).LogOnInfo
logonInfo.ConnectionInfo.DatabaseName = "DBName"
logonInfo.ConnectionInfo.ServerName = "ServerName"
logonInfo.ConnectionInfo.UserID = "sa"
logonInfo.ConnectionInfo.Password = "password"
oRpt.Database.Tables(i).ApplyLogOnInfo(logonInfo)

'Test The Connectivity
oRpt.Database.Tables(i).TestConnectivity()
Next i

CrystalReportViewer1.ReportSource = oRpt


Hope This Helps...
 
Does anyone have any ideas if the above does not work? I have the above code pasted into my crystal report page with the correct server, database, etc but it still gives me the 'logon failed' message. I have tried using both the SQL server name as well as it's IP address. Heck, I even tried using an ODBC instead. The report itself works fine on the server with the same logon info.
 
I also have the same code and it doesn't seem to run either. It doesn't get past the load
 
The report itself works fine on the server with the same logon info."

I am experiencing a similar problem; did anyone figure this one out?
SQL server stored proc based report. CR/CE10.
Report only fails via asp.net app if db connection info is NOT set to 'original info'.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top