Quantcast
Channel: VBForums - Reporting
Viewing all articles
Browse latest Browse all 594

Changing Winforms to .Net 4 from Profile for Crystal Reports

$
0
0
I have a winforms program with sql backend. I needed to use Crystal Reports for some reports and so I installed the Visual Studio Crystal Reports. I could see the CrystalReportViewer in the toolbar and found online that you need to change the Target Framework from .NET Framework 4 Client Profile to .NET Framework 4. That solved that problem but now when I run the code to run the report - StateListButton.

Code:

  Private Sub StateListButton_Click(sender As System.Object, e As System.EventArgs) Handles StateListButton.Click

        Dim zreport As New statelst
        zreport.Load("c:\Member_Program\Reports\statelst.rpt")

        Dim SearchValue As String = "MINNESOTA"
        Dim ds As New StatelstReportDataSet
        Dim ta As New StatelstReportDataSetTableAdapters.statelstTableAdapter
        ta.FillByState(ds.statelst, SearchValue)

        zreport.SetDataSource(ds)
 
        CrystalReportViewer.CrystalReportViewer1.ReportSource = zreport

    End Sub

I get this error. FileLoadException was unhandled.
Code:

Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.
I have searched the internet and found that you need to add the following code to the app.config but when I add anything I just get more errors.
Code:

<startup selegacyv2runtimeactivationpolicy="true">
  <supportedruntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client" />
</startup>

This is what my app.config looks like right now.
Code:

<?xml version="1.0"?>
<configuration>
    <configSections>
    </configSections>
    <connectionStrings>
        <add name="Member_Program.My.MySettings.EAConnectionString" connectionString="Data Source=STACY-LAPTOP\SQLEX;Initial Catalog=EA;Integrated Security=True" providerName="System.Data.SqlClient"/>
    </connectionStrings>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
    </startup>
</configuration>

Does anyone know how to fix this? I've been searching the internet for two days trying to find a fix for this. My whole program was originally built using the .NET Framework 4 Client Profile and now I needed to change it to .NET Framework 4 so I can use Crystal Reports.

Thanks!
Stacy

Viewing all articles
Browse latest Browse all 594

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>