Hi Jim,
Based on your error, change the line of code where you Dim crDatabase to the following:
Dim crDatabase As CrystalDecisions.CrystalReports.Engine.Database
When you include "()", you are defining the variable to be an array of that type.
>All,
>
> I have a webform with a Crystal report viewer on it. All I want to do is bind the viewer to a report in my project. I found an article that explains how to get around the security issue for binding the report viewer, but the code for the solution is not working. I have included the code below.
>
> I am getting a S:\projectdotnet\Reports.aspx.vb(81): Value of type 'CrystalDecisions.CrystalReports.Engine.Database' cannot be converted to '1-dimensional array of CrystalDecisions.CrystalReports.Engine.Database'.
> and a
> S:\projectdotnet\Reports.aspx.vb(83): 'tables' is not a member of 'System.Array'.
>error on the lines in bold below.
>
>Please help
>
>Dim crReportDocument As New CustReport()
> Dim crTableLogOnInfo As New TableLogOnInfo()
> Dim crConnectionInfo As New ConnectionInfo()
> Dim crDatabase As CrystalDecisions.CrystalReports.Engine.Database()
> Dim crTables As CrystalDecisions.CrystalReports.Engine.Tables
> Dim crtable As CrystalDecisions.CrystalReports.Engine.Table
>....
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
> 'Put user code to initialize the page here
> Try
> crConnectionInfo.ServerName = "Buzzlightyear"
> crConnectionInfo.DatabaseName = "project"
> crConnectionInfo.UserID = "sa"
> crConnectionInfo.Password = ""
>
> crDatabase = crReportDocument.Database
> crTables = crDatabase.tables
>
> For Each crtable In crTables
> crTableLogOnInfo = crtable.LogOnInfo
> crTableLogOnInfo.ConnectionInfo = crConnectionInfo
> crtable.ApplyLogOnInfo(crTableLogOnInfo)
> Next
>
>
> Me.crvReport.ReportSource = crReportDocument
> If Not (IsPostBack) Then
> Me.SqlconReports.Open()
> getReports()
> Me.SqlconReports.Close()
> End If
>
> Catch exp As Exception
> setMessage(exp.Message)
> Finally
> Me.SqlconReports().Close()
> End Try
>
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi