Unable to connect: incorrect log on parameters VB.NET CR9.0 Access vs. SQL Server

Posted on 2005-03-06
Medium Priority
Last Modified: 2008-02-07


I am using a VB.Net Web Form, Crystal Report Viewer (crv1), and reports created with Crystal Reports 9.0.

I'm getting an error, Unable to connect: incorrect log on parameters, when trying to veiw a report on the Crystal Web Viewer using an Access DB as its datasource.   This exact same code works just fine for another report that uses a SQL Server DB for it's datasource.  I used OLE DB(ADO) for both (Jet4.0 for Access and SQLOLEDB for SQL Server).  Are the log on requirements different for Access than it is for SQL Server?

Can someone please help me to figure out how to get the report using Access to work?

Logon Paramters I am passing for SQL Server (works)
    Dim strServer As String = "ourServerName"
    Dim strDBase As String = "ourSQLServerDatabaseName"
    Dim strUID As String = "sa"
    Dim strPWD As String = "ourPassword"

Logon Parameters for Access (doesn't seem to like this - get the error when the page loads)
    Dim strServer As String = ""
    Dim strDBase As String = "C:\Inetpub\wwwroot\OurAccessDBName.mdb"
    Dim strUID As String = "Admin"
    Dim strPWD As String = ""

Note:  The Access DB is not password protected.  I also tried to load the report using no logon info (to use the report's defaults set when it was designed, and get this error:

Unable to open file 'c:\inetpub\wwwroot\OurFolder\TestReport.rpt': The process cannot access the file because it is being used by another process.  

But that does not appear to be the case....The.mdb is closed, and there is no lock file (.ldb).

Code that works for SQL Server Report, but not for Access:

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim myReport As New ReportDocument()
        Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
        Dim myLogonInfo As CrystalDecisions.Shared.TableLogOnInfo

        For Each myTable In myReport.Database.Tables
            myLogonInfo = myTable.LogOnInfo
            myLogonInfo.ConnectionInfo.ServerName = strServer
            myLogonInfo.ConnectionInfo.DatabaseName = strDBase
            myLogonInfo.ConnectionInfo.UserID = strUID
            myLogonInfo.ConnectionInfo.Password = strPWD

        crv1.ReportSource = myReport
    End Sub
Question by:janmarini
  • 2
LVL 42

Accepted Solution

frodoman earned 2000 total points
ID: 13470674
You should be using either ServerName or DatabaseName (*not* both) depending on whether you're connecting via ODBC or OLE DB.  Also if the Access DB isn't password protected then you shouldn't be trying to pass authentication credentials to it (although depending on the version of Access it may always be protected whether you've set the option or not).

Take a look at the code here: http://support.businessobjects.com/library/kbase/articles/c2014128.asp  -- this should get you back on track.


Author Comment

ID: 13470798
Thank you!  It works :-)

LVL 42

Expert Comment

ID: 13476375
Glad to help.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question