472,783 Members | 1,020 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,783 software developers and data experts.

ASP.NET/Crystal Reports Logon Failed

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

Nov 19 '05 #1
9 6795
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

<mo****@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr 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

Nov 19 '05 #2
Thanks for your quick response. Unfortunately, your suggestion didn't
work for either of the ways I'm trying.

Nov 19 '05 #3
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

<mo****@hotmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Thanks for your quick response. Unfortunately, your suggestion didn't
work for either of the ways I'm trying.

Nov 19 '05 #4
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.

Nov 19 '05 #5
crTables --is a collection of table object(i.e. crTable)

HTH

<mo****@hotmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro 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.

Nov 19 '05 #6
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

Nov 19 '05 #7


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!
Nov 19 '05 #8
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!
Nov 19 '05 #9


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!
Nov 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bonj | last post by:
Hi I am trying to create a simple 'hello world' type web application involving a crystal report. I have basically done it the simplest possible way as described in the documentation, by adding a...
0
by: stephan | last post by:
I know that this has been beaten to death but I can't seem to resolve my issues (I have 2 of them). I have created a class that exposes a public method which returns a datatable as a datasource...
2
by: Karun Karunakaran | last post by:
Hi, I am using the Crystal Enterprise .NET assemblies to generate and display a crystal report in a webform. This report connects to an SQL server (running locally) using a specific username and...
2
by: GFro | last post by:
I am getting the following error since we upgraded from .NET Framework 1.0 to 1.1. The reports all ran fine yesterday. I get this error in all apps with reports. The apps run fine but the...
1
by: andy lim | last post by:
Hello all, I'm developing a web application using ASP.NET/VB. I have problem in viewing my CR reports. It returns following exception when I tried to view any CR report. ...
3
by: Milan Todorovic | last post by:
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...
1
by: John Dalberg | last post by:
Running Crystal Reports with the hotfixes and patches & VS 2003. I created a CR report on my development server which has SQL Server. The report runs fine inside Visual Studio. When I switched...
3
by: Shawn H. Mesiatowsky | last post by:
I have come across lots of information regarding this, but nothing seems to work. I have created a Crystal Report that access's a SQL server backend for the data, and I want to display the report...
19
by: Michael O'Donnell | last post by:
Hi All Am having major problem with crystal reports...Have designed my report no problem, its when I try to run and display ther report that I am getting a "Login Failed" message. At first I...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.