?
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,673 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses
Course of the Month7 days, 20 hours left to enroll

765 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