on 01-15-2011 2:27 AM
I'm new to Crystal Reports and trying to work my way into it.
I created a form and dropped a CrystalReportViewer onto it. I set the ReportSource to a .rpt file that I also created.
When I run my VB.NET 2010 application and click the button to open up the Viewer form I get the following error:
The type initializer for 'CrystalDecisions.Shared.SharedUtils' threw an exception.
The details says that it's the log4net error that I've seen on here in several threads. I followed these directions from another thread:
- Go into your project Properties.
- Then go to the Publish tab.
- Click the Application Files button.
- Select to Exclude any file with CrystalDecisions or BusinessObjects in the name. Plus exclude log4net.dll.
- Click OK
- Rebuild your application, then republish it to your site or file share to be installed by your clients.
No luck with that.
I then tried changing my my compile options from AnyCPU to x86 but that crashes the program on startup by complaining about my OdbcConnection.
Any suggestions are greatly appreciated.
I'm running Visual Studio 2010 on a Win 7 64-bit computer. I tried the same process in a new project and it worked there, but without actually connecting to a DSN database. I assume I have something configured wrong in my actual application but I don't know enough about Crystal Reports yet to know what to look for.
Edited by: wolfmanyoda on Jan 15, 2011 4:14 AM
Set your project framework to 4.0, not the client version.
Don't use c:\temp, rename it to c:\mytemp
Use a report with saved data then it doesn't need a DB connection as a test. Create your DSN using the 32 bit ODBC administrator in \syswow64 folder for 32 bit applications.
Have a look at these samples:
Root Page
http://wiki.sdn.sap.com/wiki/display/BOBJ/BusinessObjectsHome
Enterprise Samples (including managed and unmanaged ras)
http://wiki.sdn.sap.com/wiki/display/BOBJ/BusinessObjectsSDKSampleApplications
Non-Enterprise Samples
http://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsSDKSampleApplications
Exporting Samples (RAS)
http://wiki.sdn.sap.com/wiki/display/BOBJ/NETRASSDK+Samples#NETRASSDKSamples-Exporting%2FPrinting
Thank you
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Don.
I don't think my problem is with Crystal Reports. I can start a new project and CR will work great.
My application relies on an Access database. When I switch my compile options from AnyCPU over to x86 I get connection errors to the database, long before the application tries to use a report. This leads me to believe that the problem may be in my DSN settings.
I will try an Access forum and see if I can find answers there.
Thank you for your time.
Don Williams,
I have a DSN connection to a MySQL server, not access, and i was getting this issue as well when opening a DSN connection and when i tried to say
crystalreportviewer.ReportSource = input.toString 'input is where the .rpt file is
it would crash and give me this error.
I am forced to use a DSN as he wants to put them on computers so that only those computers could access the db to view the crystalreport.
ideas? Thoughts?
below is the code posted from my program, its not long:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
Dim connectionstring As String
Dim conn As New OdbcConnection("DSN=lalConnect")
conn.Open()
Dim input As String = getfile()
While (Not (input.Contains(".rpt")))
MessageBox.Show(input & " is NOT a .rpt file")
input = getfile()
End While
CrystalReportViewer1.ReportSource = input.ToString
conn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
'txtUsername.Text = (ex.InnerException.ToString)
Finally
End Try
End Sub
Function getfile() As String
Dim item As OpenFileDialog = New OpenFileDialog()
item.Title = "Find *.rpt file"
item.InitialDirectory = CurDir()
item.Filter = "Reports (*.rpt)|*.rpt|All files (*.*)|*.*"
item.FilterIndex = 2
item.RestoreDirectory = True
item.ShowDialog()
Return item.FileName
End Function
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.