Crystal Reports "Logon Failed" for Access Databases!!!

I

igitur

Hi people,

There seems to be a LOT of threads regarding the "Logon Failed"
problem when using Crystal Reports with ASP.NET.

But all the thread I could find was when trying to use it on SQL
server.

However, I get the problem when just trying to pull a report from an
Access database. It doesn't make sense. There is NO authentication
involved (I didn't put in any passwords), right?

Please have a look at
http://www.sun.ac.za/sms/crystalproblem.zip

The .rpt file points to
C:\Program Files\Microsoft Visual Studio\VB98\nwind.mdb

which is the only Access database I could find that would probably be
on your PC's, but any Access database should work.

I've tried the same project in C# and on my colleagues' PC's. Same
problem everywhere.

Can anybody help me? Or at least tell me if they experience the same
problem?

I have Win2K, VS.NET 2003

regards,
Francois
(underscores in email is for spammers)
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

IMHO CR needs a much better exception implementation as in the current one
almost all errors related to accesing the DB are described as "Logon
Failed".

I have never used an Access DB only MS-SQL and XML files but I think that
you need to no matter what assign the SecurityInfo to the tables of the
report. I will look in your code later cause my web access is down now :(

Cheers,
 
G

Guest

I am having the same problem getting Crystal in VS 2003 to work with an
Access db. Except when I run the report on my development laptop it works
fine. But when I copy to a production server I always get the Logon Failed
error. I have worked on this for hours, followed countless threads, and kb
articles. Nothing seems to work for me.

Here's my code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not Page.IsPostBack Then

Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo
Dim sqlConn As OleDbConnection
Dim strConnection As String
strConnection = ConfigurationSettings.AppSettings("ConnectionString")
sqlConn = New OleDbConnection(strConnection)
Dim strSQL As String
strSQL = "SELECT Proposals.*, tblInvoices.*, tblSalesCredit.* "
strSQL = strSQL & "FROM (Proposals LEFT JOIN tblInvoices ON
Proposals.PID = tblInvoices.pid) LEFT JOIN tblSalesCredit ON Proposals.PID =
tblSalesCredit.PID;"
strSQL = "Select * from Proposals"
Dim myCommand1 As New OleDbDataAdapter(strSQL, sqlConn)
Dim ds1 As New DataSet
myCommand1.Fill(DS91, "proposals")
strSQL = "Select * from tblinvoices"
Dim myCommand2 As New OleDbDataAdapter(strSQL, sqlConn)
myCommand2.Fill(DS91, "tblinvoices")
strSQL = "Select * from tblsalescredit"
Dim myCommand3 As New OleDbDataAdapter(strSQL, sqlConn)
myCommand3.Fill(DS91, "tblsalescredit")

Dim oRpt As New SalesCredit1

oRpt.Load()
oRpt.SetDataSource(DS91)
For Each myTable In oRpt.Database.Tables
myLogin = myTable.LogOnInfo
myLogin.ConnectionInfo.UserID = "Admin"
myTable.ApplyLogOnInfo(myLogin)
Next

CrystalReportViewer1.ReportSource = oRpt

As I said, the report runs perfectly on my development machine.

If anybody has the answer to this problem, myself and many others would be
eternally grateful.

Mike Parks
 
Joined
Apr 2, 2007
Messages
1
Reaction score
0
"Logon failed…" when connecting to Access database in .NET application

Visual Basic Code
"Logon failed…" when connecting to Access database in .NET application




Dim cr1
Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo

'Crystal Report Variables
Dim crReportDocument As New Reportrpt
Dim crConnectionInfo As New ConnectionInfo
Dim crTableLogonInfo As New TableLogOnInfo
Dim crDatabase As CrystalDecisions.CrystalReports.Engine.Database
Dim crTables As CrystalDecisions.CrystalReports.Engine.Tables
Dim crTable As CrystalDecisions.CrystalReports.Engine.Table







Dim path1 As String = Application.StartupPath & "\AnsonsAccounting.mdb"



With crConnectionInfo
'.DatabaseName = path1 'If you are connecting to Access through ODBC, then set the 'DatabaseName' for the ConnectionInfo' object as follows:
.ServerName = path1 'If you are connecting to Access through OLE DB, then set set the 'ServerName':
.UserID = "Admin"
.Password = ""
End With


crDatabase = crReportDocument.Database
crTables = crDatabase.Tables

For Each crTable In crReportDocument.Database.Tables
crTableLogonInfo = crTable.LogOnInfo
crTableLogonInfo.ConnectionInfo = crConnectionInfo
crTable.ApplyLogOnInfo(crTableLogonInfo)
Next
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top