.vb class file not created for crystal report in asp.net 2005

I am having problems figuring this out.  I am trying to do an automatic login in a crystal report using asp.net 2005.  From a previous post I got the code to do this.

The problem I seem to be having is that VS 2005 doesn't seem to be creating the .vb file under the .rpt report file.  Because of this I can create a new variable for the strongly instantiated report.  Example:

My report is called PalletLogReport.rpt
The asp.net page is called PalletLog.aspx
In the .vb code under the .aspx I have the following:

Dim crReportDocument As PalletLogReport()

The compiler then tells me that PalletLogReport is not defined.

What is happening here?  This is happening in VS 2005, does VS not create these files anymore in 2005?  

Who is Participating?
I am not sure about VS 2005, but in VS 2003 there is such option once I right click on the .rpt file.
Other than implement the report using strongly instantiated, could you try other method such as

Import CrystalDecision.ReportEngine
Import CrystalDecision.Shared
Dim crReport = new ReportDocument()
crReport.Load("Your rpt...")

It will be more flexible than using strongly instantiated, because you don't have to pre-generate a report class for each report.

Did you build the dsr for the report?  To get the class, I believe you have to "import" the report into your application.

I am not sure about VS2005, but from VS2003, if I right click the .rpt file and click "Run Custom Tool", it will generate the .vb file for you.

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

sbhegelAuthor Commented:

What is the dsr?  And what do you mean by import?  I have made a copy of this file, deleted the original and then did and add existing item.  That still doesn't work.

sbhegelAuthor Commented:

I don't see a Run Custom Tool option when I right click the .rpt file.  Is there another way to access this?
sbhegelAuthor Commented:

I am totally confused now.  Here is the code I have in the web page that has the CR viewer in it.   This is in the Page_load procedure:

        Dim crReportDocument As New ReportDocument()        
        Dim crTableLogonInfos As TableLogOnInfos
        Dim crTableLogonInfo As TableLogOnInfo
        Dim crConnectionInfo As ConnectionInfo
        ' crReportDocument = New PalletLogReport()
        crTableLogonInfos = New TableLogOnInfos()
        crTableLogonInfo = New TableLogOnInfo()

        crConnectionInfo = New ConnectionInfo()
        With crConnectionInfo
            .ServerName = "myserver"
            .DatabaseName = "mydb"
            .UserID = "myuser"
            .Password = "mypassword"
        End With

        crTableLogonInfo.ConnectionInfo = crConnectionInfo
        crTableLogonInfo.TableName = "PalletLabel"

        CrystalReportViewer1.LogOnInfo = crTableLogonInfos
        CrystalReportViewer1.ReportSource = crReportDocument

What is incorrect about this?
sbhegelAuthor Commented:
I figured this one out.  The reason the .vb file is not created for the .rpt file in VS 2005 is because:

In Visual Studio 2005, Crystal Reports report files are no longer embedded in Web projects; therefore, no report wrapper class is generated. The reports are stored in a folder and, as with all non-embedded reports, they must be referenced by their file directory path. In this case, the directory path is to the current Web Site folder.

However, Windows projects in Visual Studio 2005 remain unchanged from earlier Visual Studio versions; they continue to use embedded reports.

Also the code I listed above didn't automatically login but the code below does:

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Dim crDatabase As Database
Dim crTables As Tables
Dim crTable As Table
Dim  crTableLogOnInfo As TableLogOnInfo
Dim crConnectionInfo As ConnectionInfo

CrConnectionInfo = New ConnectionInfo()
With crConnectionInfo
      .DatabaseName = “database”
      .Password = “password”
      .ServerName = “servername”
      .UserID = “user id”
End With

CrDatabase = report.Database
CrTables = crDatabase.Tables

For Each crTable in crTables
      CrTableLogOnInfo = crTable.LogOnInfo
      CrTableLogOnInfo.ConnectionInfo = crConnectionInfo

CrystalReportViewer1.ReportSource = report

The difference is one was logging into the view and this code is passing the logon information to the report.

I don't know the best way to give out the points on this, so if the moderator could lend there knowledge, I would appreciate it.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.