assistance converting crystalreports 2011 reports

i am desperate to find someone who can explain how to uses existing reports (all called from vb6 with ease) to be called from vb.net

I have asked several questions ans so far none of the answers have worked.  i seem to get the feeling that these reports will have to be called in a totally different method, most answers seem to advocate using .xsd files with a push method.

1. Does this mean all reports have to be re-written, or can a datasource change handle the issue.

2. Reports will run as they exist, but there doesn't seem to be a way to pass sql login info. All reports require user to login to the database.

I have read so much online but 95% is how to create reports, and very little on using existing reports.

Is there anyone that can help me with this,  8-10 lines of code in VB6 seems to be 60 plus in VB.NET.
Larry RungrenDirector of TechnologyAsked:
Who is Participating?

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

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

Larry RungrenDirector of TechnologyAuthor Commented:
i ask this because i want, if at all possible the leave the reports outside the .NET environment so that changes to reports, happens with great frequency, will not require a redistribution/update of the entire application to multiple users.
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
Not enough information to address your question (for example, what data source and what connectivity method).

Instead of coding this yourself, there are several 3rd-party free or inexpensive Crystal Reports viewers (see list at http://kenhamady.com/bookmarks.html). Some of those viewers provide a command line API so you can call them from within your application specifying the rpt and, if necessary, parameters, login info, data source (if you need to switch data source on the fly)...
Larry RungrenDirector of TechnologyAuthor Commented:
It seems that the "free" viewers are not free, like all such lists they are misleading, and when you are going to install an application on 8 - 15 desktops it gets real expensive real fast. How does an app as integrated as Crystal Reports get thrown to the wayside by MSFT, or at least put in a posture that users have to totally re-think and redesign and probably re-implement at their cost, years and years of development/
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

Éric MoreauSenior .Net ConsultantCommented:
>>How does an app as integrated as Crystal Reports get thrown to the wayside by MSFT

Crystal is not owned by Microsoft. It has been provided for free for a long time in the box and is still available for free from the SAP website.

Your main problem is that the version you currently have working with VB6 is dated from the late 1990s. Things has since changed! VB6 moved to the .Net world so the CR also required some changes.
Larry RungrenDirector of TechnologyAuthor Commented:
Eric,

You are really the only one at EE who has seemed to understand my questions.  

If I have an existing report designed and built in CR 2011, that allows the user to enter selection parameters, is there any way to run the report as-is from VB.NET?  I can load the report, enter the parameters and the report runs perfectly, with one exception,
it does not recognize the database login as passed.

Here is the code from 6-7 sites that say this should work, any idea why it doesn't?

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.Windows.Forms
Imports CrystalDecisions.ReportSource
Public Class frmreports

    Private Sub CrystalReportViewer1_Load(sender As System.Object, e As System.EventArgs) Handles CrystalReportViewer1.Load
        dispreport()
    End Sub


    Public Sub dispreport()
        Dim cryRpt As New ReportDocument
        Dim crtableLogoninfos As New TableLogOnInfos
        Dim crtableLogoninfo As New TableLogOnInfo
        Dim crConnectionInfo As New ConnectionInfo
        Dim CrTables As Tables
        Dim CrTable As Table

        cryRpt.Load("j:\crystalreports\evaluations\completedseminaranalysis.rpt")

        With crConnectionInfo
            .ServerName = "MCLE_SQL2008\MCLE_SQL2008;"
            .DatabaseName = "iMIS_MCLE_Prod"
            .UserID = "sa"
            .Password = "password"
        End With

        CrTables = cryRpt.Database.Tables
        For Each CrTable In CrTables
            crtableLogoninfo = CrTable.LogOnInfo
            crtableLogoninfo.ConnectionInfo = crConnectionInfo
            CrTable.ApplyLogOnInfo(crtableLogoninfo)
        Next
'
'  This is from the suggested code doesn't work at all
'
        'CrystalReportViewer1.ReportSource = cryrpt

'
' Using this the report requests a database password and then runs correctly
'
        CrystalReportViewer1.ReportSource = ("j:\crystalreports\evaluations\completedseminaranalysis.rpt")               
        'CrystalReportViewer1.Show()
        CrystalReportViewer1.Refresh()
    End Sub

  
End Class

Open in new window



If this will never work, even though several people seem to think it does, can I engage your services to go through the process as you have described using the push method with .XSD files, if it does not require totally re-writing the reports?
Éric MoreauSenior .Net ConsultantCommented:
>>it does not recognize the database login as passed

I would need to dig to find the issue. Your CR2011 files would also be required as I don't have that version.

>>can I engage your services to go through the process

yes as it has already been discussed.

>>as you have described using the push method with .XSD files, if it does not require totally re-writing the reports?

Changing the method to push .XSD to reports requires complete recreation of reports as you change the whole data source.
mlmccCommented:
I can't remember if I have included these links for converting VB6 to .Net

Migrating from the RDC to the .Net  Assemblies
http://scn.sap.com/docs/DOC-21971

https://msdn.microsoft.com/en-us/library/ms225492(v=vs.80).aspx

mlmcc
Éric MoreauSenior .Net ConsultantCommented:
mlmcc, if Jeff is already using CR2011 as stated in his last comment, is he still using .rdc files?
mlmccCommented:
You may be able to create the new connection then use the set data source to change the source.

mlmcc
mlmccCommented:
I doubt it.  He was trying to convert the code from the VB6 application.  The links provide clues on how to change the VB6/RDC code to VB.Net/assemblies.  He may have mixed methods some way.

When I had to develop a report viewer for our VB6 app, we were able to make our dev network look like the prod network and had the database server names the same and on the same drives.  We were able to take the app and reports from dev to prod and everything worked with no changes.

When people ask (before developing the reports) I recommend your method.  It avoids all the issues of changing the database connection in the reports.

mlmcc
Larry RungrenDirector of TechnologyAuthor Commented:
After 2 weeks of searching and trying different solutions I have found the answers I was looking for.

To run an existing Crystal report from VS2010 (VB code) that requires the user to enter a parameter value:

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.Windows.Forms
Imports CrystalDecisions.ReportSource

Public Class frmcompletedseminar
    Private Sub CrystalReportViewer1_Load(sender As System.Object, e As System.EventArgs) Handles CrystalReportViewer1.Load
        dispreport()
    End Sub


    Public Sub dispreport()
        Dim cryRpt As New ReportDocument
        cryRpt.Load("j:\crystalreports\evaluations\completedseminaranalysis.rpt")
        cryRpt.SetDatabaseLogon("sa", "password",
                           "dsn", "databasename", False)
        CrystalReportViewer1.ReportSource = cryRpt
        CrystalReportViewer1.Show()
    End Sub

Open in new window



If, as in the case of datasource is a storedprocedure requiring parameter(s)

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.Windows.Forms
Imports CrystalDecisions.ReportSource
Public Class frmGroupHistory

    Private Sub frmGroupCrystalReportViewer1_Load(sender As System.Object, e As System.EventArgs) Handles CrystalReportViewer1.Load
        dispreport()
    End Sub

    Public Sub dispreport()
        Dim cryRpt As New ReportDocument
        Dim paramFields As New CrystalDecisions.Shared.ParameterFields()
        Dim paramField As New CrystalDecisions.Shared.ParameterField()
        Dim discreteVal As New CrystalDecisions.Shared.ParameterDiscreteValue()
        cryRpt.Load("j:\crystalreports\evaluations\historyrecap.rpt")
        cryRpt.SetDatabaseLogon("username", "password",
                   "dsn", "database name", False)
        paramField.ParameterFieldName = "productcode"
        Dim str As String = frmControl.txtProductCode.Text.ToString
        discreteVal.Value = str
        paramField.CurrentValues.Add(discreteVal)
        paramFields.Add(paramField)
        CrystalReportViewer1.ParameterFieldInfo = paramFields
        CrystalReportViewer1.ReportSource = cryRpt
        CrystalReportViewer1.Refresh()
    End Sub
End Class

Open in new window


I have tested the app, run a build and created an install .msi and installed on another system and it works fine.

The only thing I have found is crCR for VS2010 must be installed on the client machine first.

Let me know if you see any pitfalls, PLEASE.
Éric MoreauSenior .Net ConsultantCommented:
>>The only thing I have found is crCR for VS2010 must be installed on the client machine first

you have to. The CR viewer needs to be installed.

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
Larry RungrenDirector of TechnologyAuthor Commented:
Along road there  but a solution to running reports  developed outside of vs2010 in Crystal reports is found.

Your support in my quest has been greatly appreciated.

The last plug I need to get working is passing the parameter to subreports, but that should be fairly straight forward now that I have the bulk of the process cut down to sensible size.

Once again THANKS
Éric MoreauSenior .Net ConsultantCommented:
passing parameters to sub-reports is another interesting challenge!

the best way is to create a parameter on the main report and link the sub-report parameter to the main one (in Crystal).

I don't remember the exact steps but I found this (http://www.crystalreportsbook.com/Forum/forum_posts.asp?TID=2497) :
Follow these steps to pass the parameters from main report to sub report

1. Create a new paramter @mainParam in the main report by right-clicking on 'Parameter Fields' section in Field explorer in the main report.

2. Create a new parameter @subParam in the sub report in the same manner (This wouldn't be required if  you already have the parameter in the sub report)

3. Right click on the sub report in the desing window in your main report.

You will be able to see an option 'Change Subreport Links'.

4. Click on the option and select the @mainParam and transfer it to the sub report using '>' button.

5. Select the appropriate field in the sub report to map to

6. Click ok.

 

Now the field will be appearing only once in the criteria
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.