[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 638
  • Last Modified:

Crystal reports in VB2010.net suddenly not working

Hello All

I have got an issue i really need help with as it is driving me, and my customer mad


I have a VB.net 2010 application that uses crystal to produce reports and it has been working very well on site for nearly 18 months now.  I had a problem on my development machine so i changed it. I reinstalled the same copy of VB.net 2010, the same copy of SAP Crystal Reports version for VB 2010 and the same 64 bit runtime engine for .netframework 4.

 

When i debug/run my application in the VB IDE it runs perfectly but as soon as i compile and run the .exe the application crashes when calling a report. The same code has run for months but since the reinstall it is crashing with no error message

 

The code to call a report is as follows

               

If DGstockgrid.SelectedRows.Count = 0 Then

    MessageBox.Show("Please select an item to re-print", "Re-Print Selection", MessageBoxButtons.OK, MessageBoxIcon.Information)

Exit Sub

           

Else

               

Dim STRUID As String = DGstockgrid.SelectedRows(0).Cells(0).Value

Dim ds As New DataSet

Dim cnn As SqlConnection

Dim connectionString As String

Dim sql As String

Dim cryRpt As New ReportDocument

 cryRpt.Load("C:\Reports\pallet1.rpt")

 connectionString = strCompCon

 cnn =New SqlConnection(connectionString)

 cnn.Open()

 sql = "select * from stock where uid = '" & STRUID & "'"

Dim dscmd As New SqlDataAdapter(sql, cnn)

 dscmd.Fill(ds,"ReportSelect")

Dim INTrowcount As Integer = (ds.Tables("ReportSelect").Rows.Count)

  cnn.Close()

               

If INTrowcount = 0 Then

                   

MessageBox.Show("There is no data avaliable to print for this report. Please check and try again", "Data Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

                   

Exit Sub

               

Else

      THIS IS WHERE IT CRASHES              

cryRpt.SetDataSource(ds.Tables("ReportSelect"))

FrmCryrep.CrystalReportViewer1.ReportSource = cryRpt

FrmCryrep.CrystalReportViewer1.Refresh()

 

 

The target CPU is set for any and the framwork is set for .net 4.

The application doesnt error at runtime it just crashes with the application not responding and all you can do is close

Hope someone has some ideas

 

Many thanks
0
Antste
Asked:
Antste
  • 13
  • 4
  • 4
  • +1
1 Solution
 
CodeCruiserCommented:
Is the operating system same as before? Which one?
0
 
AntsteAuthor Commented:
Sorry, Yes the O/S is 64-bit windows 7, as are the target machines on my clients site
0
 
CodeCruiserCommented:
Could it be due to reports being in a C folder as Windows 7 usually denies access to majority of file system. Did you try putting the reports folder within the app folder?
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
AntsteAuthor Commented:
They have always been in the same place. If it was a permissions issue wouldnt i get that at debug as well as runtime, and also wouldnt it generate an actual error rather than just a crash ?

I was thinking more along the lines of maybe a reference issue but i cant see what if any im missing,
0
 
CodeCruiserCommented:
Do you have global error handling in your app? Anything in event viewer? Does it make a difference if you right click the exe and select Run As Admin?
0
 
AntsteAuthor Commented:
In the application event log i have 2 errors

EVENT 1026 .NETRUNTIME
   Application: Application.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.IO.FileNotFoundException Stack: at System.Reflection.RuntimeAssembly._nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, Boolean, Boolean, Boolean) at System.Reflection.RuntimeAssembly.nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, Boolean, Boolean, Boolean) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(System.Reflection.AssemblyName, System.Security.Policy.Evidence, System.Threading.StackCrawlMark ByRef, Boolean, Boolean) at System.Reflection.RuntimeAssembly.InternalLoadFrom(System.String, System.Security.Policy.Evidence, Byte[], System.Configuration.Assemblies.AssemblyHashAlgorithm, Boolean, Boolean, System.Threading.StackCrawlMark ByRef) at System.Reflection.Assembly.LoadFrom(System.String) at CrystalDecisions.ReportAppServer.DataSetConversion.DataSetConverter.DataSetProcessingDelegate(IntPtr)  


EVENT 100 APPLICATION ERROR
 application.exe
   1.0.0.0
   50452ff1
   KERNELBASE.dll
   6.1.7601.17651
   4e211319
   e0434352
   0000b9bc

I have tried searching for these errors but not much luck so far
0
 
AntsteAuthor Commented:
further update

I let it run the windows debug and it is coming up with

Could not load file or assembly 'file:///C:\Program Files (x86)\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.

the folder dotnet1 doesnt exist and as far as i can tell never has but im not sure where it is saying look in this place in the application either?
0
 
AntsteAuthor Commented:
Bit more info

every answer i have come across so far says to add a line to the app.config file. In the IDE i look at the config file and the line it wants already exists as shown below

<?xml version="1.0"?>
<configuration>
      <system.diagnostics>
    <sources>
      <!-- This section defines the logging configuration for My.Application.Log -->
      <source name="DefaultSource" switchName="DefaultSwitch">
        <listeners>
          <add name="FileLog"/>
          <!-- Uncomment the below section to write to the Application Event Log -->
          <!--<add name="EventLog"/>-->
        </listeners>
      </source>
    </sources>
    <switches>
      <add name="DefaultSwitch" value="Information"/>
    </switches>
    <sharedListeners>
      <add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter"/>
      <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
      <add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION.exe"/>
    </sharedListeners>
  </system.diagnostics>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="office" publicKeyToken="71E9BCE111E9429C" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Vbe.Interop" publicKeyToken="71E9BCE111E9429C" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
    <generatepublisherevidence enabled="false" />
  </runtime>
  <startup>
    <startup useLegacyV2RuntimeActivationPolicy="true" />
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>

</configuration>

I have never done anything with this file before so i am assuming it just gets included with the exe when i compile, is this correct?

If not it makes sense that the debug runs ok with this config file but runtime doesnt because it isnt referencing this file, so how do i correct that error

Am i seeing a chink of light at the end of the tunnel or am i going down a blind alley?

Hope you all can help an man with ever increasing bags round his eyes
0
 
CodeCruiserCommented:
This config file has to be copied along the exe file.
0
 
AntsteAuthor Commented:
I never have before but i have made a new installer and included the app.config file, putting it in the same folder as the application.exe

Still the same result
0
 
mlmccCommented:
DId you install the same service packs?

Did you reset the references in the code before recompiling?

Are you replacing the Crystal assemblies on the client machine?

What version of Crystal?

mlmcc
0
 
AntsteAuthor Commented:
I installed the same Crystal runtime and vb.net package
I have removed and then re added the refrences but they were in same place etc.
I have not done anything to client machines as yet because i cant get it to work on any of my machines outside of the IDE
Crystal appears to be version 13.0.2

Hope you can help?
0
 
AntsteAuthor Commented:
Just looking at the refrence screen for the umpteenth time and all the crystal refrences say the version number is 13.0.2000.0

The actual version number if i folow the path given for the refrence is 13.0.2.469. I have removed the refrences and then put them back but they keep the version number they had previously. Is that an issue? and if so how can i sort?

Can you feel the straws being clutched :)
0
 
mlmccCommented:
WHen you installed Crystal for VS2010 did you instal the ADO database drivers?

I am not sure they are installed by default.

mlmcc
0
 
AntsteAuthor Commented:
not seperatly ? but there is a reference to crystaldecisions.data.adodotnetinterop.dll in the project. It does exist so i presume this is what you mean ?

I have also moved all the files it was referencing in then added them again but the version numbers are still showing as 13.0.2000

barking up wrong tree ?

Steve
0
 
mlmccCommented:
I don't know.

It would seem like something is missing in  your new install file but if you are using the runtime on the client it should include the database drivers.

Did the MDAC version change with the new machine?

mlmcc
0
 
AntsteAuthor Commented:
I dont know.

Are you thinking it is more to do with data access rather than crystal viewer creation ?
0
 
mlmccCommented:
The data connection method you seem to be missing is for ADO.  That uses MDAC as part of the connection.  I don't know if having MDAC 2.x on one machine and 2.y on another would cause an issue or not.

mlmcc
0
 
AntsteAuthor Commented:
I use the exact same method for retrieving data to show in datagrids throughout the application plus it woirks in the IDE so not sure that is the issue

Thanks for help and suggestions so far. I am going a bit drastic today. Im going to flatten the reinstall a laptop i have got and see if i can make it all work on there with a clean system

See if that works, will let you all know

Cheers
0
 
Manoj PatilSr. Software EngineerCommented:
Hey Is your crystal report trial version.. ?
I had the same problem for crystal report.... So I have posted this problem on their forum.
Some one has suggest me to re-install the crystal report package with removing temp. files
I had follow the steps and it Started working...
0
 
AntsteAuthor Commented:
It isnt a trial version i am using. I have reinstalled the apps on a fresh install on a laptop and i have the same issue, ok in the IDE , not working when installed, on the same machine even~?

Im going to write a new app just to test a report and see if that works, will report back. In the meantime im getting desperate. What is an alternative to crystal for vb.net 2010. I used to use reportmanager but struggled with 64 bit operating systems so i switched to crystal

Steve
0
 
AntsteAuthor Commented:
I solved this issue by setting the net framework to 3.5 . Dont know why i had to do it but that is what has made it work.

Not sure how to appportion points etc as no one came close in my opinion

Any ideas mods etc?
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 13
  • 4
  • 4
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now