Unable to connect: incorrect log on parameters VB.NET CR9.0 Access vs. SQL Server
Posted on 2005-03-06
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