on 01-24-2007 7:15 PM
<p>Hi everybody,</p><p> </p><p>i am struggling to connect CR for .NET to a password-protected ACCESS database at runtime in VB.NET. I read most of the documentation covering this subject. The infamous knowledge base <span style="margin-left: 5px">article "c2010460</span> " says that this can be possible via "convert the native connection to an ODBC or OLE DB connection which supports Access session security" but there is no explanation on how to do that.</p><p> </p><p>If this issue is also in CR Developer Edition, i am not happy on spending hundreds of dollars for not having fixed such a simple task. I don't get it why this is not yet properly implemented.</p><p> </p><p>Me! </p>
Hello,
please also use links to MS supprt sites like the ones below
http://support.microsoft.com/kb/225048
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, Adrian;
To convert from the native driver to OLE DB or ODBC, do the following:
- Open the report in the .NET IDE
- Right click a blank section of the report and choose Database -> Set Location
- In the Replace With box, choose either OLE DB or ODBC, and go through the steps to make the connection.
- Back in the Set Location box, in the Current Data Source, make sure the Table is selected, and then select the same table in the Replace With box from the new connection you made.
- Click the Replace button, and the report should be converted to the new driver.
The following Visual Basic.NET sample code demonstrates how to access a password protected Ms-Access database programmatically.
-
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class Form1
Inherits System.Windows.Forms.Form
Dim report As New SampleReport
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ConfigureCrystalReports()
End Sub
Private Sub ConfigureCrystalReports()
Dim crConnectionInfo As ConnectionInfo = New ConnectionInfo
crConnectionInfo.ServerName = (Application.StartupPath & "\Sample.mdb")
crConnectionInfo.Password = "TEST"
setDBLogonForReport(crConnectionInfo, report)
CrystalReportViewer1.ReportSource = report
End Sub
Private Sub setDBLogonForReport(ByVal connection As ConnectionInfo, ByVal report As ReportDocument)
Dim mytables As Tables = report.Database.Tables
Dim mytable As CrystalDecisions.CrystalReports.Engine.Table
For Each mytable In mytables
Dim mytablelogoninfo As TableLogOnInfo = mytable.LogOnInfo
mytablelogoninfo.ConnectionInfo = connection
mytable.ApplyLogOnInfo(mytablelogoninfo)
Next
End Sub
End Class
Cheers,
Jonathan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is great, Jonathan, that your example handles logon with a user name and user password. But MS Access has another level of protection. This level is the database password level. At this level all you need is a password without a user name.
Do you have an idea of how to logon as in your example, with 1. database password, and then 2. user ID and User password
many Thanks
NickO
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.