Skip to Content
author's profile photo Former Member
Former Member

Sub reports will not work in VS2010

I have installed crystal reports for VS2010 (EXE) package from SAP web site.

I am using VS2010 for my application.

My VB.NEt app was originally developed in VS2003 several years ago. The app has about 150 crystal reports, which ran fine on .NET 1.1 without a problem, My company decided to upgrade the project to .NET4.0 recently.

I have migrated all the code and the reports to .NET 4.0. I can build and compile fine. When I launch the app, it runs fine also.

I have been able to open crystal reports which dO NOT HAVE SUB REPORTS embedded in them. They seem fine.

Every report that has a sub report causes VS2010 to crash. In the debug mode, the code fails when i try to set the report source.

I get the below error.

{"Could not load file or assembly 'file:///C:
Program Files
SAP BusinessObjects
Crystal Reports for .NET Framework 4.0
Common
SAP BusinessObjects Enterprise XI 4.0
win32_x86
dotnet1
crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified.":"file:///C:
Program Files
SAP BusinessObjects
Crystal Reports for .NET Framework 4.0
Common
SAP BusinessObjects Enterprise XI 4.0
win32_x86
dotnet1
crdb_adoplus.dll"}

I have changed my app config to the folliowing.

<startup useLegacyV2RunTimeActivationPolicy="true">

<supportedRuntime version="v4.0"/>

</startup>

Below is the code snippet that Crystal report crashes. All my reports uses ADO.NET XML files. I create an xml file, specify the column names in the xml file, set the report source to a dataset that has a table containing the same name as the XML root element and the same columns.

Public Sub LoadForm11_Acct(ByRef Ds1 As DataSet, ByRef Ds2 As DataSet, _

ByRef Ds3 As DataSet, ByVal sYear As Int16)

crRptDoc = New rptAcctForm11

Dim sSub1 As CrystalDecisions.CrystalReports.Engine.ReportDocument

Dim sSub2 As CrystalDecisions.CrystalReports.Engine.ReportDocument

Dim sTaxYear As CrystalDecisions.CrystalReports.Engine.TextObject = _

CType(crRptDoc.ReportDefinition.ReportObjects.Item("txtYear"), _

CrystalDecisions.CrystalReports.Engine.TextObject)

sTaxYear.Text = sYear

'CRASHES RIGHT AT THE BELOW LINE

crRptDoc.SetDataSource(Ds1)

sSub1 = crRptDoc.OpenSubreport("rptP11-Vehicles.rpt")

sSub2 = crRptDoc.OpenSubreport("rptVehicleListing.rpt")

sSub1.SetDataSource(Ds2)

sSub2.SetDataSource(Ds3)

Me.Text = "Assessor's Personal Book For Individual Account"

Me.crPA.ReportSource = crRptDoc

End Sub

Any help would be appreciated.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Mar 01, 2012 at 11:15 PM

    Strange as the crdb_adoplus.dll should be loading from C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86.

    Check to see that all CR assemblies are version 13.x.

    Make sure your app is using the Full 4.0 framework, not the client framework. Compile the app and run it from the compiled exe. What error do you get now?

    Ludek

    Follow us on Twitter http://twitter.com/SAPCRNetSup

    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

    Add a comment
    10|10000 characters needed characters exceeded

    • Hello,

      Thanks for the info.... In our Legacy XML driver it did read all types as strings and we don't recall now if the ADO.NET driver did the same back in that version. So it could be you designed the reports off the Legacy XML driver or it may be that the .NET driver did the same.

      one option is to use this:

                  ds.WriteXml("c:\\Reports\\abc.xsd", XmlWriteMode.WriteSchema);
                  ds.WriteXml("c:\\Reports\\abc.xml", XmlWriteMode.IgnoreSchema);
      
                  rpt.SetDataSource(ds);
      

      It should show you what CR is expecting in the Schema now and I do know the current ADO.NET driver does support data types. So you may have no option but to verify your subreports.

      Here's an option for you also, get the links, change the types and add them back in through code:

      case "SubReport Links":
          btnReportObjects.Text = "";
          btnCount.Text = "";
          foreach (String resultField in rptClientDoc.SubreportController.GetSubreportNames())
          {
              textBox1 = resultField.ToString();
              btnReportObjects.Text += "Subreport Name: " + textBox1;
              btnReportObjects.AppendText(":\n");
      
              SubreportLinks SubLinks = rptClientDoc.SubreportController.GetSubreportLinks(resultField.ToString());
              for (int I = 0; I < SubLinks.Count; I++)
              {
                  SubreportLink subLink = SubLinks<i>;
                  textBox1 = subLink.LinkedParameterName.ToString();
                  btnReportObjects.Text += "PM-Name: " + textBox1;
                  btnReportObjects.AppendText("\n");
                  textBox1 = subLink.MainReportFieldName.ToString();
                  btnReportObjects.Text += "Main Field: " + textBox1;
                  btnReportObjects.AppendText("\n");
                  textBox1 = subLink.SubreportFieldName.ToString();
                  btnReportObjects.Text += " Sub Field: " + textBox1;
                  btnReportObjects.AppendText(" 'End' \n");
              }
              btnCount.Text = SubLinks.Count.ToString();
          }
          break;
      

      Does require you to use ReportApplicationServer ( inProc RAS ) to make the changes.

      Up to you, depends on how many canned reports you have.

      Don

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2015 at 07:26 PM

    After a lot of search and research i found a solution, which may be stupid, but it works for me.

    for the subreport when you create the data fields with database expert do not create a command, instead select any one table from the database. (please see that table to have all your necessary datatype fields like decimal,date, string which will be in your final report)

    add the fields to the report as per your runtiime datatables fieldtype from this table and change the headers according to your report.

    and at the runtime create the dataset with the table containing all your necessary datafileds but with the name of the other table which we added at the time of development.

    example : your report's data source is "select [Tax Rate], sum(amount) amt from sometable group by taxrate"

    but in your report desgin you add a table having one string field and other with decimal field for example the name can be like this txnno (numeric field), details (string field)

    you set the datasource with "select [tax rate] as details, amt as txnno from (select [Tax Rate], sum(amount) amt from sometable group by taxrate) a "

    if works fine.

    To say in a single line.....

    " do not use command ...use table in the database expert " at the time of designing the Sub Report. (this is not a rule for main report"

    if i am not clear in explaining the solution, contact me.ramnath555 at the rate hotmail dot com

    Message was edited by: Ramanathan RM

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.