Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP.NET/Crystal Reports Logon Failed

Reply
Thread Tools

ASP.NET/Crystal Reports Logon Failed

 
 
mollyf@hotmail.com
Guest
Posts: n/a
 
      02-24-2005
I have tried various suggestions that I have found searching the
newsgroups and still haven't been able to figure why I keep getting the
logon failed error.

I created a report in Crystal (not via VS 2003). The data source to
the report is a stored procedure (SQL S2K) that has no parameters. I'm
also using SQL Server authentication to log in.

I added the report to my project (as was suggested recently by someone
in a different thread). I have tried the following code:

Dim myReport As New ProvidersList

Dim conStrBH As String =
ConfigurationSettings.AppSettings("conStrBH")
Dim cnn As SqlConnection = New SqlConnection(conStrBH)
Dim cmd As New SqlCommand
Dim ProvIDParam As New SqlParameter
Dim i As Integer

cnn.Open()
cmd.Connection = cnn
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "sp_GetProviders"

myReport.Database.Tables(0).SetDataSource(cmd)
myReport.Load()
CrystalReportViewer1.ReportSource = myReport
cnn.Close()

conStrBH is a connection string located in the web.config and is used
throughout the app. There is no problem with the connection string as
I wouldn't be able to log into the web app if there was a problem
there.

I've also tried the following code, which is similar to what VS help
showed.

Dim myReport As New ProvidersList
Dim logOnInfo As New TableLogOnInfo
Dim i As Integer

For i = 0 To myReport.Database.Tables.Count - 1
' Set the connection information for current table.
logOnInfo.ConnectionInfo.ServerName = "servername"
logOnInfo.ConnectionInfo.DatabaseName = "databasename"
logOnInfo.ConnectionInfo.UserID = "username"
logOnInfo.ConnectionInfo.Password = "password"

myReport.Database.Tables.Item(i).ApplyLogOnInfo(lo gOnInfo)
Next i
myReport.Database.Tables(0).ApplyLogOnInfo(logOnIn fo)
myReport.Load()
CrystalReportViewer1.ReportSource = myReport


In both cases, I get the same error:

CrystalDecisions.CrystalReports.Engine.LogOnExcept ion: Logon failed.

I'm doing this on my local machine running Win XP Pro. Any help would
be appreciated.

Thanks.

Molly J. Fagan
Oklahoma Foundation for Medical Quality

 
Reply With Quote
 
 
 
 
Vaibhav
Guest
Posts: n/a
 
      02-24-2005
I think you need to load the report first and then provide the logon info.

> >>>>>>>>. myReport.Load()<<<<<<<<<<<<<<<<



> For i = 0 To myReport.Database.Tables.Count - 1
> ' Set the connection information for current table.
> logOnInfo.ConnectionInfo.ServerName = "servername"
> logOnInfo.ConnectionInfo.DatabaseName = "databasename"
> logOnInfo.ConnectionInfo.UserID = "username"
> logOnInfo.ConnectionInfo.Password = "password"
>
> myReport.Database.Tables.Item(i).ApplyLogOnInfo(lo gOnInfo)
> Next i
> myReport.Database.Tables(0).ApplyLogOnInfo(logOnIn fo)


> CrystalReportViewer1.ReportSource = myReport


HTH

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
>I have tried various suggestions that I have found searching the
> newsgroups and still haven't been able to figure why I keep getting the
> logon failed error.
>
> I created a report in Crystal (not via VS 2003). The data source to
> the report is a stored procedure (SQL S2K) that has no parameters. I'm
> also using SQL Server authentication to log in.
>
> I added the report to my project (as was suggested recently by someone
> in a different thread). I have tried the following code:
>
> Dim myReport As New ProvidersList
>
> Dim conStrBH As String =
> ConfigurationSettings.AppSettings("conStrBH")
> Dim cnn As SqlConnection = New SqlConnection(conStrBH)
> Dim cmd As New SqlCommand
> Dim ProvIDParam As New SqlParameter
> Dim i As Integer
>
> cnn.Open()
> cmd.Connection = cnn
> cmd.CommandType = CommandType.StoredProcedure
> cmd.CommandText = "sp_GetProviders"
>
> myReport.Database.Tables(0).SetDataSource(cmd)
> myReport.Load()
> CrystalReportViewer1.ReportSource = myReport
> cnn.Close()
>
> conStrBH is a connection string located in the web.config and is used
> throughout the app. There is no problem with the connection string as
> I wouldn't be able to log into the web app if there was a problem
> there.
>
> I've also tried the following code, which is similar to what VS help
> showed.
>
> Dim myReport As New ProvidersList
> Dim logOnInfo As New TableLogOnInfo
> Dim i As Integer
>
> For i = 0 To myReport.Database.Tables.Count - 1
> ' Set the connection information for current table.
> logOnInfo.ConnectionInfo.ServerName = "servername"
> logOnInfo.ConnectionInfo.DatabaseName = "databasename"
> logOnInfo.ConnectionInfo.UserID = "username"
> logOnInfo.ConnectionInfo.Password = "password"
>
> myReport.Database.Tables.Item(i).ApplyLogOnInfo(lo gOnInfo)
> Next i
> myReport.Database.Tables(0).ApplyLogOnInfo(logOnIn fo)
> myReport.Load()
> CrystalReportViewer1.ReportSource = myReport
>
>
> In both cases, I get the same error:
>
> CrystalDecisions.CrystalReports.Engine.LogOnExcept ion: Logon failed.
>
> I'm doing this on my local machine running Win XP Pro. Any help would
> be appreciated.
>
> Thanks.
>
> Molly J. Fagan
> Oklahoma Foundation for Medical Quality
>



 
Reply With Quote
 
 
 
 
mollyf@hotmail.com
Guest
Posts: n/a
 
      02-24-2005
Thanks for your quick response. Unfortunately, your suggestion didn't
work for either of the ways I'm trying.

 
Reply With Quote
 
Vaibhav
Guest
Posts: n/a
 
      02-24-2005
mentioned below is my code which work fine on my machine. code is invoked
from within
Private Sub Page_Init()

crReportDocument.Load(Server.MapPath("crXYZ.rpt"),
OpenReportMethod.OpenReportByTempCopy)

With crConnectionInfo

.ServerName = "XYZ"

.DatabaseName = "SOMEDB"

.UserID = "SOMEUSERID"

.Password = "SOMEPASS"

End With

crTables = crReportDocument.Database.Tables

'sets connection info. for database tables

For Each crTable In crTables

crtableLogoninfo = crTable.LogOnInfo

crtableLogoninfo.ConnectionInfo = crConnectionInfo

crTable.ApplyLogOnInfo(crtableLogoninfo)

Next

'sets the report source

CrystalReportViewer1.ReportSource = crReportDocument

End Sub

HTH

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> Thanks for your quick response. Unfortunately, your suggestion didn't
> work for either of the ways I'm trying.
>



 
Reply With Quote
 
mollyf@hotmail.com
Guest
Posts: n/a
 
      02-24-2005
What kind of objects are crTables and crTable? I found some code
similar to yours and guessed at what types they could be but still
haven't had any luck.

Thanks so much for your help.

 
Reply With Quote
 
Vaibhav
Guest
Posts: n/a
 
      02-25-2005
crTables --is a collection of table object(i.e. crTable)

HTH

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> What kind of objects are crTables and crTable? I found some code
> similar to yours and guessed at what types they could be but still
> haven't had any luck.
>
> Thanks so much for your help.
>



 
Reply With Quote
 
mollyf@hotmail.com
Guest
Posts: n/a
 
      02-28-2005
I'm still getting the logon failed error. Below is all of my code. I
no longer have the report as part of the project. Is there something
that I need to do to the server to make it work? I'm hitting the
database to log into my web app but I don't know if there's additional
steps needed for Crystal that I'm missing or what.

Thanks for your help.


Dim crConnectionInfo As New
CrystalDecisions.Shared.TableLogOnInfo
Dim crTables As CrystalDecisions.CrystalReports.Engine.Tables
Dim crReportDocument As New
CrystalDecisions.CrystalReports.Engine.ReportDocum ent
Dim crTable As CrystalDecisions.CrystalReports.Engine.Table
Dim crtableLogoninfo As CrystalDecisions.Shared.TableLogOnInfo
crReportDocument.Load(Server.MapPath("ProvidersLis t.rpt"),
OpenReportMethod.OpenReportByTempCopy)

With crConnectionInfo.ConnectionInfo
.ServerName = "server"
.DatabaseName = "database"
.UserID = "user"
.Password = "password"
End With

crTables = crReportDocument.Database.Tables

'sets connection info. for database tables

For Each crTable In crTables
crtableLogoninfo = crTable.LogOnInfo
crtableLogoninfo.ConnectionInfo =
crConnectionInfo.ConnectionInfo
crTable.ApplyLogOnInfo(crtableLogoninfo)
Next

'sets the report source

CrystalReportViewer1.ReportSource = crReportDocument

 
Reply With Quote
 
Stacy Dudas
Guest
Posts: n/a
 
      03-01-2005


I am having a similar issue. I am using Crystal Reports 10 and Delphi
7. My development database is different than my production database.
In previous versions of Crystal (9 and 8.5) I was able to delete the DSN
and table owner from the Crystal application - Database | Set Location,
Table edit box on the bottom of the screen.
ie. from dsn_name.dbo.tablename to tablename

This worked with my production and development reports when called
through Delphi.

Crystal 10 does not allow the changing of the table under the set
location. I am receiving the "Logon failed" error as well.

Do you have any suggestions?

Thanks,
Stacy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
Nate Papineau
Guest
Posts: n/a
 
      03-14-2005
I was getting the same error when using the ApplyLogOnInfo method
against a stored proc.

I gave execute permissions for the user i was logging on as to the
stored proc (should have done that in the first place but forgot) and it
worked.

Hope that helps.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
Joseph Bowen
Guest
Posts: n/a
 
      03-15-2005


This problem is bedeviling me too. Here is a Microsoft note on the
issue:

http://support.microsoft.com/default...en-us%3B319264

Beware, their example code is written in C#.

But, this doesn't fix my problem. I am working within VS, and created
the report and the webpage with the report viewer in the designer. I
theorize that the report I'm setting the logon info for is not the same
instance as the report that is being shown, the one created in the
designer. Anybody familiar with this issue?

I've tried
setting logon userid/pw
changing ASPNET user's permissions
try/catch statements
and am lost. Any thoughts welcome.

Joe



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Crystal Reports "Logon Failed" for Access Databases!!! igitur ASP .Net 3 04-02-2007 06:52 AM
Question Help: Logon vs Account Logon, Local Logon vs Authentication CJH Microsoft Certification 0 01-04-2006 04:03 PM
Crystal Reports 'Logon failed' problem Milan Todorovic ASP .Net 3 03-18-2005 03:35 AM
Logon failed. Crystal Reports .NET GFro ASP .Net 2 07-23-2004 07:33 PM
Logon failed with Crystal Reports Carlo Marchesoni ASP .Net 2 08-25-2003 09:29 AM



Advertisments