

#CRYSTAL REPORTS RUNTIME ENGINE ARENA SOFTWARE#
" If you are using more than one database with different usernames and passwords, use a loop to pass in the different values.Our streamlined software for building web pages that run your Crystal Reports on the web. See knowledge base article C2010460 for more information. It is not possible to report of a secured Access database using a native connection.

If you are connecting to Access through OLE DB, then set set the 'ServerName': DatabaseName = "C:\mydatabase\mydata.mdb" " If you are reporting off an Access database, then specify either the 'ServerName' or 'DatabaseName' to the 'ConnectionInfo' Object depending on how you are connecting to Access.įor example, if you are connecting to Access through ODBC, then set the 'DatabaseName' for the 'ConnectionInfo' object as follows: Refer to knowledge base article c2010275 if you wish to change database logon information in the main and subreport. You can either specify the table name only or the fully qualified table name such asĬrTable.location = "" " If you are changing database at runtime, it is important that you specify the table location after you apply logon information (this is a case sensitive property).

The additional knowledgebase articles referenced can be found at:
#CRYSTAL REPORTS RUNTIME ENGINE ARENA CODE#
" If the above code still results in a logon failure in a web application (ASP.NET), refer to knowledge base article c2010867 (For Windows 2000) or c2013758 (Windows 2003 Server (IIS6)), and ensure that the ASPNET account has sufficient access to the database, reports, and the application directories. " If you are using a web application make sure that you do not specify or call the DataBind in your code as this will nullify the code above. Set the viewer to the report object to be previewed.ĬrystalReportViewer1.ReportSource = crReportDocument For example, when you are reporting off of a Northwind database on SQL server you should have the following line of code:ĬrTable.Location = "Northwind.dbo." + ((".") + 1) If your DatabaseName is changing at runtime, specify the table location. Loop through all tables in the report and apply the connection information for each table.ĬrTableLogOnInfo.ConnectionInfo = crConnectionInfo ĬrTable.ApplyLogOnInfo(crTableLogOnInfo) This code works for both user tables and stored procedures. Get the table information from the report crConnectionInfo.DatabaseName = "" ĬrConnectionInfo.DatabaseName = "DatabaseName" ĬrConnectionInfo.Password = "Your Password" If you are connecting to Oracle there is no DatabaseName. If using OLEDB, etc, this should be the physical server nameĬrConnectionInfo.ServerName = "DSN or Server Name" If using ODBC, this should be the DSN. Setup the connection information structure to log on to the data source for the report. Private ConnectionInfo crConnectionInfo = new ConnectionInfo ()

Private CrystalReport1 crReportDocument = new 'Set the viewer to the report object to be previewed.ĬrystalReportViewer1.ReportSource = crReportDocument 'For example, when you are reporting off of a Northwind database on SQL server you should have the following line of code:ĬrTable.Location = "Northwind.dbo." & ((".") + 1) 'If your DatabaseName is changing at runtime, specify the table location. 'Loop through each table in the report and apply the LogonInfo informationĬrTableLogonInfo.ConnectionInfo = crConnectionInfo Set the CrTables to the Tables collection of the reportĬrTables = 'This code works for both user tables and stored procedures. 'If you are connecting to Oracle there is no 'DatabaseName. If you are NOT using ODBC, this should be the physical server name 'Set the ConnectionInfo properties for logging on to the Database If you are using ODBC, this should be the DSN name NOT the physical server name. 'If you are using a Non-Typed report, and loading a report outside of the project, use the following:ĭim crReportDocument As New ReportDocument()ĬrReportDocument.Load("c:\myReports\myReport.rpt") 'If you are using a Strongly Typed report (Imported in 'your project) named CrystalReport1.rpt use the 'following:ĭim crReportDocument As New CrystalReport1() Imports ĭim crtableLogoninfos As New TableLogOnInfos()ĭim crtableLogoninfo As New TableLogOnInfo()ĭim crConnectionInfo As New ConnectionInfo() To pass logon information to a Crystal Report at runtime, use the following code sample:
