M
mollyf
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(logOnInfo)
Next i
myReport.Database.Tables(0).ApplyLogOnInfo(logOnInfo)
myReport.Load()
CrystalReportViewer1.ReportSource = myReport
In both cases, I get the same error:
CrystalDecisions.CrystalReports.Engine.LogOnException: 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
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(logOnInfo)
Next i
myReport.Database.Tables(0).ApplyLogOnInfo(logOnInfo)
myReport.Load()
CrystalReportViewer1.ReportSource = myReport
In both cases, I get the same error:
CrystalDecisions.CrystalReports.Engine.LogOnException: 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