468,761 Members | 1,773 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,761 developers. It's quick & easy.

Crystal Reports 'Logon failed' problem

Hello,

I need help. I have experience in ASP.NET programming, but this is my first
dealing with Crystal Reports. I'm trying to make the most basic report
purely for testing purposes: connect to the remote SQL DB and create a
report on one of the tables. Every time I do it, I get the Logon Failed
error (CrystalDecisions.CrystalReports.Engine.LogOnExcep tion: Logon failed)

The internet search shows that this is a common problem, especially for
those using the 'pull' method. In my case it occurs in both 'push' and
'pull' methods. The problem I guess lies in the lack of credentials to
connect to the data source (DB in this case). Most solutions mentions the
SetDatabaseLogon method, but that method does not belong to the
ReportDocument object even though the documentation shows that it should.
Even with all those solutions, I still haven't managed to solve my problem!
I have a feeling I'm missing something really obvious.

To explain what exactly I'm doing. In a project, I created the
CrystalReport1.rpt file, that connects to the SQL DB by specifying the
server, username and password (not using integrated security). In the
webform I created a CrystalReportViewer instance crv. In the code behind I
put the following code:

Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocum ent()
rpt.Load("C:\\Inetpub\\wwwroot\\TestCrystal\\Cryst alReport1.rpt")
crv.ReportSource = rpt
crv.DataBind()

What exactly do I need to do here to get this report to show? Any input is
greatly appreciated.

Thanks

Milan
Nov 19 '05 #1
3 14762
Hi,

Try this:
http://www.dotnetjunkies.com/Tutoria...40CA588D33D3.d
cik

HTH,
Mike

"Milan Todorovic" <mi*************@ttu.edu> wrote in message
news:Oj**************@tk2msftngp13.phx.gbl...
Hello,

I need help. I have experience in ASP.NET programming, but this is my first dealing with Crystal Reports. I'm trying to make the most basic report
purely for testing purposes: connect to the remote SQL DB and create a
report on one of the tables. Every time I do it, I get the Logon Failed
error (CrystalDecisions.CrystalReports.Engine.LogOnExcep tion: Logon failed)
The internet search shows that this is a common problem, especially for
those using the 'pull' method. In my case it occurs in both 'push' and
'pull' methods. The problem I guess lies in the lack of credentials to
connect to the data source (DB in this case). Most solutions mentions the
SetDatabaseLogon method, but that method does not belong to the
ReportDocument object even though the documentation shows that it should.
Even with all those solutions, I still haven't managed to solve my problem! I have a feeling I'm missing something really obvious.

To explain what exactly I'm doing. In a project, I created the
CrystalReport1.rpt file, that connects to the SQL DB by specifying the
server, username and password (not using integrated security). In the
webform I created a CrystalReportViewer instance crv. In the code behind I
put the following code:

Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocum ent()
rpt.Load("C:\\Inetpub\\wwwroot\\TestCrystal\\Cryst alReport1.rpt")
crv.ReportSource = rpt
crv.DataBind()

What exactly do I need to do here to get this report to show? Any input is
greatly appreciated.

Thanks

Milan

Nov 19 '05 #2
I don't know if this will help or not, but it's worth a try. Depending on
the way you have the connection from your Crystal Report to your SQL Server,
you'll have to "log in" the Crystal Report. In other words, your Crystal
Report has to connect to the SQL Server someway. I added some code. Hope
it helps.

Dim tblCurrent As CrystalDecisions.CrystalReports.Engine.Table
Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo
Dim strSel As String
Dim ClassID As Integer = 1
Try
'get report file and location from web.config
oRpt.Load(CS.AppSettings("RptLocation") & CS.AppSettings("RptFileName"))
Catch lex As LoadSaveReportException
lblError.Text = "Error loading the report" & vbCrLf & lex.Message
Catch ex As Exception
lblError.Text = "General Error" & vbCrLf & ex.Message
End Try
Try
'log the Crystal Report in
For Each tblCurrent In oRpt.Database.Tables
tliCurrent = tblCurrent.LogOnInfo
With tliCurrent.ConnectionInfo
'get log in info from web.config
.ServerName = CS.AppSettings("SQLServer")
.DatabaseName = CS.AppSettings("Database")
.UserID = CS.AppSettings("UserId")
.Password = CS.AppSettings("Password")
End With
'apply the log in info
tblCurrent.ApplyLogOnInfo(tliCurrent)
Next tblCurrent
Catch ex As Exception
lblError.Visible = True
lblError.Text = "Report Logon Error" & vbCrLf & ex.Message
End Try
Try
crv1.ReportSource = oRpt
Catch ex As Exception
lblError.Text = "Selection Error" & vbCrLf & ex.Message
End Try
End Sub

"Milan Todorovic" <mi*************@ttu.edu> wrote in message
news:Oj**************@tk2msftngp13.phx.gbl...
Hello,

I need help. I have experience in ASP.NET programming, but this is my first dealing with Crystal Reports. I'm trying to make the most basic report
purely for testing purposes: connect to the remote SQL DB and create a
report on one of the tables. Every time I do it, I get the Logon Failed
error (CrystalDecisions.CrystalReports.Engine.LogOnExcep tion: Logon failed)
The internet search shows that this is a common problem, especially for
those using the 'pull' method. In my case it occurs in both 'push' and
'pull' methods. The problem I guess lies in the lack of credentials to
connect to the data source (DB in this case). Most solutions mentions the
SetDatabaseLogon method, but that method does not belong to the
ReportDocument object even though the documentation shows that it should.
Even with all those solutions, I still haven't managed to solve my problem! I have a feeling I'm missing something really obvious.

To explain what exactly I'm doing. In a project, I created the
CrystalReport1.rpt file, that connects to the SQL DB by specifying the
server, username and password (not using integrated security). In the
webform I created a CrystalReportViewer instance crv. In the code behind I
put the following code:

Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocum ent()
rpt.Load("C:\\Inetpub\\wwwroot\\TestCrystal\\Cryst alReport1.rpt")
crv.ReportSource = rpt
crv.DataBind()

What exactly do I need to do here to get this report to show? Any input is
greatly appreciated.

Thanks

Milan

Nov 19 '05 #3
chuck, thanx for the code snipplet. I can't believe that C Reports is just as
messy since four years ago when i started to use them (deployng them via a
windows app).

The only thing with your code is that I can't figure out how to populate the
report with my dataset?

I've tried,
testr.SetDataSource(dstABC)
testr.Load(Server.MapPath("reportname1.rpt"))

but I get an error:
[LoadSaveReportException: Invalid report file path.]

Help???? This shouldn't have to be this hard. Thanx. (VB.NET)
"chuckdfoster" wrote:
I don't know if this will help or not, but it's worth a try. Depending on
the way you have the connection from your Crystal Report to your SQL Server,
you'll have to "log in" the Crystal Report. In other words, your Crystal
Report has to connect to the SQL Server someway. I added some code. Hope
it helps.

Dim tblCurrent As CrystalDecisions.CrystalReports.Engine.Table
Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo
Dim strSel As String
Dim ClassID As Integer = 1
Try
'get report file and location from web.config
oRpt.Load(CS.AppSettings("RptLocation") & CS.AppSettings("RptFileName"))
Catch lex As LoadSaveReportException
lblError.Text = "Error loading the report" & vbCrLf & lex.Message
Catch ex As Exception
lblError.Text = "General Error" & vbCrLf & ex.Message
End Try
Try
'log the Crystal Report in
For Each tblCurrent In oRpt.Database.Tables
tliCurrent = tblCurrent.LogOnInfo
With tliCurrent.ConnectionInfo
'get log in info from web.config
.ServerName = CS.AppSettings("SQLServer")
.DatabaseName = CS.AppSettings("Database")
.UserID = CS.AppSettings("UserId")
.Password = CS.AppSettings("Password")
End With
'apply the log in info
tblCurrent.ApplyLogOnInfo(tliCurrent)
Next tblCurrent
Catch ex As Exception
lblError.Visible = True
lblError.Text = "Report Logon Error" & vbCrLf & ex.Message
End Try
Try
crv1.ReportSource = oRpt
Catch ex As Exception
lblError.Text = "Selection Error" & vbCrLf & ex.Message
End Try
End Sub

"Milan Todorovic" <mi*************@ttu.edu> wrote in message
news:Oj**************@tk2msftngp13.phx.gbl...
Hello,

I need help. I have experience in ASP.NET programming, but this is my

first
dealing with Crystal Reports. I'm trying to make the most basic report
purely for testing purposes: connect to the remote SQL DB and create a
report on one of the tables. Every time I do it, I get the Logon Failed
error (CrystalDecisions.CrystalReports.Engine.LogOnExcep tion: Logon

failed)

The internet search shows that this is a common problem, especially for
those using the 'pull' method. In my case it occurs in both 'push' and
'pull' methods. The problem I guess lies in the lack of credentials to
connect to the data source (DB in this case). Most solutions mentions the
SetDatabaseLogon method, but that method does not belong to the
ReportDocument object even though the documentation shows that it should.
Even with all those solutions, I still haven't managed to solve my

problem!
I have a feeling I'm missing something really obvious.

To explain what exactly I'm doing. In a project, I created the
CrystalReport1.rpt file, that connects to the SQL DB by specifying the
server, username and password (not using integrated security). In the
webform I created a CrystalReportViewer instance crv. In the code behind I
put the following code:

Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocum ent()
rpt.Load("C:\\Inetpub\\wwwroot\\TestCrystal\\Cryst alReport1.rpt")
crv.ReportSource = rpt
crv.DataBind()

What exactly do I need to do here to get this report to show? Any input is
greatly appreciated.

Thanks

Milan


Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Bonj | last post: by
2 posts views Thread by Karun Karunakaran | last post: by
2 posts views Thread by GFro | last post: by
1 post views Thread by andy lim | last post: by
9 posts views Thread by mollyf | last post: by
3 posts views Thread by Shawn H. Mesiatowsky | last post: by
19 posts views Thread by Michael O'Donnell | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.