Link to home
Start Free TrialLog in
Avatar of Ralph Green
Ralph GreenFlag for United States of America

asked on

Switching to vb.net with Crystal.....

Hello,

I have a vb6 solution that I am running with CRXIR2.  It is working well as I am passing the parameters to the report and letting it run.

I am only responsible for the form that runs the reports.

The team is now in the process of re-writing the program to VB.net.

Can I please get some advice on what I need to do to prepare for this.  I am taking a class in VB.net,   but I think that I am currently running the reports in a not very efficient way and I am willing to look at a different approach.  

I need advice on 2 things...
1.  Do I need to get a more current version of crystal?
2.  What is the most used way of running the reports, ie doing an SQL query in vb.net and passing that recordset to crystal or passing the parameters and letting crystal run the report.  

Based on the answers above, which way would be the easiest to  modify a report and test it?
Right now I just run the report in crystal and copy the rpt to directory and VB runs it.

My coding skills are only what I needed to do what I am doing now, so I'd like to keep it as simple as possible.

Thank you for your opinion and advice.
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

I have always preferred to push a dataset to Crystal. Often, you already most of the data already in memory so no need to requery it. Also, you can manipulate the data before sending the final dataset to the report (much more flexible in .Net).

Have a look at https://www.emoreau.com/Entries/Articles/2016/10/Crystal-Reports-for-Net-revisited-10-years-later.aspx
1) Oh, sure. Xi was 2005(?). It's out of support.

2) For report building it is not really relevant, what you do. But as Éric wrote, it's simpler to form the result set in VB.NET, when the data retrieval is a complex process.
But as you're migrating an old system, I would do it in two steps;

- Just recode your front-end. Don't change the reporting. (Assuming that you can run XI in .NET)
- When the new front-end works as intended, then upgrade the CR.
- Now you can look into new strategies to deliver the data to your reports.
Avatar of Ralph Green

ASKER

Thank you both for your replies.

I know that Crystal stopped using RDC but I don't know if XI works with .net.  If I can find some sample code where parameters are being passed, I'll try it.
Avatar of Mike McCracken
Mike McCracken

Check these articles from SAP
Migrating Applications from the RDC to the Crystal Reports XI .NET Assemblies
https://apps.support.sap.com/sap/support/knowledge/public/en/1206830

Link to PDF
http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/e0eb394f-931e-2b10-3b82-9413bfc3f457

mlmcc
IF you are using an SQL server in the mix,
 I would change to SSRS reports. Works with all Microsoft products. and is cheaper than CR software.
Thank you for your replies.  Here is where I stand now.

I downloaded the sample code from mlmcc and it wants crystaldecisions not the craxdrt.dll that I have.  I tried to download crystaldecisions but only got version 13. I don't know if that is the issue or not.  I can't run the code as I get crviewer1 is not defined.  Any references to crystaldecisions shows the yellow triangle so I assume I don't have the "correct" crystaldecisions .dll  Again, I am using Visual Studio 2019 and have the crystall reports 11.5 R2 installed.  I am willing to upgrade the crystal reports, but I will still need to support the current situation of 11.5 and VB6 until this all gets sorted out for the upgrade to VB.net that I am trying to accomplish here.

Thank you again for your help.

Also, right now I have a combination off Access and SQL that I connect to for the reports.  Will SSRS work in this case?

Ralph
OK, I am going to start over with this project.

I am going to code in vb.net and want to run crystal reports.  I have 11.5 now but I am willing to upgrade to a newer version if necessary.
I want to have the reports be separate from the code so I can modify a report and not have to compile every time.  I know it's a little slower for the report to run that way but much easier to modify and test the reports.  I just want to pass the db connection and the parameters to the report viewer.

What Version of Crystal do you recommend I use?  I want to be able to distribute the project to our customers so I'll need to know what dll's etc will need to be installed on the customers computers to be able to run my little project to run reports.

I hope that made sense, please feel free to ask questions if you need further information.

Ralph
>>I want to have the reports be separate from the code

if you refer to my article, you will see that I have the reports in their own project. I copy the .rpt files to a network share and the application loads the report from there. Very easy to maintain without redeploying the full app.

>>I just want to pass the db connection and the parameters to the report viewer.

I much prefer to pass a dataset already filled with the data I need. Again, check my article.

>>What Version of Crystal do you recommend I use?

What kind of application? WinForms or WPF? I still use the free version and I am fully satisfied with it.

>>I want to be able to distribute the project to our customers so I'll need to know what dll's

You need to use the full CR deployment package. You cannot just copy a few DLLs.
I have looked at your article and tried to run the code on my 2019 visual studio.  My Crystal is 11.5R2.
Your code did not like or could not reference my current crviewer.  I tried to install the latest Crystal for .net from SAP and it did not work either.
I referenced that in my earlier post but no one replied, so I thought maybe I had just incompatible versions and would just start over.
I really liked your article and the way you described how it worked.  I'm just not a very good coder at all and have spent my time learning Crystal and learned enough code tp create a form in VB6 to interface with CR11.5.

With that in mind I have a few questions still:

>>I want to have the reports be separate from the code

if you refer to my article, you will see that I have the reports in their own project. I copy the .rpt files to a network share and the application loads the report from there. Very easy to maintain without redeploying the full app.
I like that and that is perfect.

>>I just want to pass the db connection and the parameters to the report viewer.

I much prefer to pass a dataset already filled with the data I need. Again, check my article.
I am willing to learn to do it that way as my impression is that the dataset in VB will faster that passing the db connection and the parameters as I am now.

>>What Version of Crystal do you recommend I use?

What kind of application? WinForms or WPF? I still use the free version and I am fully satisfied with it.
If I understand correctly, I will use Winforms as it is a desktop solution as far as VB.net goes.  My questions was, do I need to upgrade to Crystal 12 or is CR11.5R2 good enough for what we are discussing.

>>I want to be able to distribute the project to our customers so I'll need to know what dll's

You need to use the full CR deployment package. You cannot just copy a few DLLs.
Is CR13SP26MSI64_0-10010309.MSI what you are referring to?  I am deploying this now with 11.5R2 but I am still confused, and I apologize for my lack of knowledge, but if I can get vb.net to work with 11.5, I'll be set.  With your code, I can't get a viewer referenced that the code likes.  This seems to be my main issue.  I would be willing to work directly with you if you wish.  Your sample looks like exactly what I need but I can't get a crviewer that will load.
I would be willing to work directly with you if you wish.


Ralph Green
posmanralph@yahoo.com
If you want to use CR with VS2019, you will need a version that is compatible: https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads

>>Is CR13SP26MSI64_0-10010309.MSI what you are referring to?

yes if your application is targeting a 64-bits platform. otherwise you will need CR13SP26MSI32_0-10010309.MSI.

You cannot mix CR11 and CR13, it is one or the other and as per https://help.sap.com/viewer/0d6684e153174710b8b2eb114bb7f843/SP21/en-US/45c10f1f6e041014910aba7db0e91070.html, for .Net, you need CR13.
Just an FYI, This is the error I'm getting

  this.crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();

Severity      Code      Description      Project      File      Line      Suppression State
Error      CS0246      The type or namespace name 'CrystalDecisions' could not be found (are you missing a using directive or an assembly reference?)      DemoCrystalReportsCS      D:\DemoCrystalReports\DemoCrystalReportsCS\Form1.cs      5      Active
Sorry, I posted without seeing your reply.

So I should get Crystal 13?  Developer I assume....
yes and SP25 or better (strongly suggest SP26)
I have purchased CR2016 and have VS2019
The sampl;e code says the same thing :
this.crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer()
Is there a different reference I need to use?
I've tried downloading the latest report engine but there is no reference listed for crystal decisions.

The SP26 page is the most confusing page I have dealt with.  I'm not sure I have the latest stuff....

Version file attached.

Again thank you for your help

Ralph
ScreenHunter-04.pdf
I don't know for CR2016. I have always used the free version.

Since you have the paid version, you should contact their support!
LOL
I tried that, it's an AI that is not very good.

Thanks, again.  I'm about ready to find another report writer as Crystal 2016 seems to be a mess anyway.
have you given a try to their free version?
Getting 2013 with sp26 now

Hopefully that will like your cool code
You need to download CR for Visual Studio.
https://www.crystalreports.com/crvs/confirm/
CR v13 is the version for Visual Studio

There is no SDK for the standalone versions of Crystal 20xx.
this was done, I've got sp26.

I'm just not getting the reference to anything that says Crystaldecisions.....  which is what the code is looking for.  I can never view the for because it wants to load the reportviever from crystaldecisions....

This has been an ordeal.  I wish I didn't need so much help.  If I can get the code you wrote to load I'll have something to work with.

Ralph
Just to be clear, I have VS2019 with CR13 and the crystal for .net SP26
I still don't see any reference for crystaldecisions that the code calls for.

this.crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer()
I suspect the reference has changed.  

The company providing Crystal Reports has changed names/been acquired many times.  In the early 2000's it was a company called Crystal Decisions and the libraries bore their name.  It is now being developed and maintained by SAP and the libraries have changed names.

I am not a .NET programmer and don't have an environment tp use to check what the assemblies are called.  

I hope Eric can provide the names that are needed or perhaps his article will show you what is needed.
IN his code (about 2/3 through) is the equivalent line to yours
        CrystalReportViewer1.ReportSource = mrptDoc

mlmcc
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.