.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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.

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.

C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

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?
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.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.