Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
|
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 29th, 2006, 11:45 AM
Authorized User
 
Join Date: Mar 2004
Posts: 33
Thanks: 0
Thanked 1 Time in 1 Post
Default how to set the crystal report data source location

Is there any way to set the crystal report data source location to the application.startup-path?
__________________
gbilios
The Following User Says Thank You to gbilios For This Useful Post:
 
Old May 30th, 2006, 12:50 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes it can be.
IF I UNDERSTOOD YOU properly, (you are asking, if data to the report is comming
from one SQL SERVER and you need the same report but the data from the differnt
SQL SERVER without modifing the REPORT)

If yes then it can be done.

Use
ConnectionInfo();
TableLogOnInfo();
SetDatabaseLogon(DBUserName, DBUserPassword, DBServerName, DBName);

to change the data source location of the report.

DBUserName, DBUserPassword, DBServerName, DBName
all are entries in the web.congif file. change the value of the key
and you are done to get the data from the new location.

Hope this helps



With Regards,
Raghavendra Mudugal
 
Old May 30th, 2006, 06:06 AM
Authorized User
 
Join Date: Mar 2004
Posts: 33
Thanks: 0
Thanked 1 Time in 1 Post
Default

We are using Microsoft Access database. The problem is that when we make changes the Database, the report keeps showing the old data. Its a stand-alone application. We want to be able to show the new data using VB.NET everytime we update the database. Is there a way we can overcome this situation?
 
Old May 30th, 2006, 06:57 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Okay.

BUT the first post and your second post has no link at all. First post says something and second says another.

Anyway.

TO this, while you create report, in report options you can uncheck the check box
so it does not saves any data in the report while you save. and
when showing the report use (ReportDocument) rd.HasSavedData = false; (of your report.

I guess you have the data saved in .rpt file and you are just opening the report
on click of the button or something.

OR ELSE Just try running SQL query while you open the report in the application.
this will refreshes the report and gets the present data.

Hope this helps.


With Regards,
Raghavendra Mudugal
 
Old May 30th, 2006, 07:57 AM
Authorized User
 
Join Date: Mar 2004
Posts: 33
Thanks: 0
Thanked 1 Time in 1 Post
Default

I'll give that a try and get back to you
 
Old May 31st, 2006, 06:34 AM
Authorized User
 
Join Date: Mar 2004
Posts: 33
Thanks: 0
Thanked 1 Time in 1 Post
Default

what is happening is that crystal reports keeps referring to the database path used while compile. therefore if the report is shown on the computer where it was compiled then it refers to the wrong database. however, if the exe and database is put on another system or we use msi and install the software on another system, only crystal reports still asks for the old compile database path. we are using ole db. is there any way to make the path relative?
 
Old May 31st, 2006, 11:40 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Okay,

Even I have faced this problem in VB6.0

So what I have done is, rather than using the database path directly, I was using
ODBC-DSN in the report and through logically i used to change the location of the
DSN when application starts and set the database location to the ms-access db
which will reside with application.

So try using the DSN in the report rather than reffering the access db directly.
and when you deploy the application at the client's place just set the DSN location of the access DB where it is located.

This actually solved my problem. I was using the same report with different customer access DB. Report look and feel is same but only it gets the data from
active DB.

hope this helps.


With Regards,
Raghavendra Mudugal
 
Old June 1st, 2006, 12:37 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OR

try this

Namespace: CrystalDecisions.Shared and in this ConnectionInfo Class

Private Sub SetConnectionInfo(ByVal table As String, _
ByVal server As String, ByVal database As String, _
ByVal user As String, ByVal password As String)

   ' Get the ConnectionInfo Object.
   Dim logOnInfo As New TableLogOnInfo()
   logOnInfo = Report.Database.Tables.Item(table).LogOnInfo

   Dim connectionInfo As New ConnectionInfo()
   connectionInfo = Report.Database.Tables.Item(table).LogOnInfo.Conne ctionInfo

   ' Set the Connection parameters.
   connectionInfo.DatabaseName = database
   connectionInfo.ServerName = server
   connectionInfo.Password = password
   connectionInfo.UserID = user
   Report.Database.Tables.Item(table).ApplyLogOnInfo( logOnInfo)
End Sub

DatabaseName: String. Gets or Sets the name of the database.

Password: String. Gets or sets the Password for logging on to the data source

ServerName: String. Gets or sets the name of the server or ODBC data source where the database is located.

UserID: String. Gets or sets a user name for logging on to the data source.

I guess this will fix your CR problem what you are facing. Here you can change
the location of the MS-ACCESS DB or the DSN as needed.

hope this helps.


With Regards,
Raghavendra Mudugal
 
Old June 9th, 2006, 07:39 AM
Authorized User
 
Join Date: Mar 2004
Posts: 33
Thanks: 0
Thanked 1 Time in 1 Post
Default

I added the appropriate merge module: Crystal Reports10_Net_EmbeddedReporting.msm to my setup.exe / .msi installer files and the following error message is displayed when i select a report. Can anyone explain this error and why its happening?

************** Exception Text **************
System.IO.FileNotFoundException: Could not load file or assembly 'CrystalDecisions.CrystalReports.Engine, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.
File name: 'CrystalDecisions.CrystalReports.Engine, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304'
   at CAT.MDIParent.ItemReportToolStripMenuItem_Click(Ob ject sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Obje ct key, EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.OnClick(Eve ntArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(Eve ntArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(M ouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventIntera ctive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(Event Args e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEven tArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(M ouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.ToolStripDropDown.WndProc(Mes sage& m)
   at System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].



************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINNT/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
CAT
    Assembly Version: 1.0.2347.35762
    Win32 Version: 1.0.2347.35762
    CodeBase: file:///C:/Program%20Files/Deakin%20University/CATProject/CAT/CAT.exe
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 8.0.0.0
    Win32 Version: 8.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINNT/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINNT/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINNT/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINNT/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINNT/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINNT/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Runtime.Remoting
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINNT/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
System.Data
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINNT/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Transactions
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINNT/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINNT/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
 
Old June 10th, 2006, 01:58 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

System.IO.FileNotFoundException: Could not load file or assembly 'CrystalDecisions.CrystalReports.Engine, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.

This errot clearly tells that what report your are accessing is not available at the specified path.
By making the report as an Embedded Resource, and calling the report in the ReportDocument object
by physical path and if this report is not available at that path. Then you have this error.

If you are opening the Report from the binary dll file (which is embedded in your project dll),
opening such report are not as easy job ar opening the report from the physical path.

refer these sections..
1.ResourceManager Class
2.Assembly.GetManifestResourceStream Method.

So, in my previous projects, i shipped the report with my installation pack and made sure
the report is available at that location while executing it.

In your case, physical reports are not shipped in the intallation pack, and you are opening the
report by reffering the physical path in the .cs file, and the reports are embedded in the assembly,
where your logic or code is not reaching there. Here you have to get the Report from the assembly
rather than from physical path. Like, say.. a image is loaded in the .resx file and your are loading
this image from Resource file to the image control on the click of the button.

Hope this helps.



With Regards,
Raghavendra Mudugal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Crystal report binding with large data set, error lankark Crystal Reports 0 April 3rd, 2008 09:16 AM
Changing Database location for crystal report swarnapy VB How-To 0 August 27th, 2006 11:37 PM
changing data source location at run time sandeepjakhotya Crystal Reports 0 April 16th, 2006 05:40 AM
set data source to blank report lpastor Crystal Reports 0 October 15th, 2004 05:21 AM
Ch 8, Crystal Reports Engine, "Set D.B. Location" wpeck BOOK: Professional Crystal Reports for VS.NET 0 January 30th, 2004 04:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.