?
Solved

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

Posted on 2005-03-06
3
Medium Priority
?
1,678 Views
Last Modified: 2008-02-07

Hi,

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
       
        myReport.Load(Page.Server.MapPath("TestReport.rpt"))

        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
            myTable.ApplyLogOnInfo(myLogonInfo)
        Next

        crv1.ReportSource = myReport
       
    End Sub
0
Comment
Question by:janmarini
  • 2
3 Comments
 
LVL 42

Accepted Solution

by:
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.

frodoman
0
 
LVL 7

Author Comment

by:janmarini
ID: 13470798
Thank you!  It works :-)

0
 
LVL 42

Expert Comment

by:frodoman
ID: 13476375
Glad to help.
0

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