cancel
Showing results for 
Search instead for 
Did you mean: 

Datasource incorrect on deployed report

Former Member
0 Kudos

I've been looking for an answer to deploying a CR for a couple days now. I have finally figured out how to get the viewer to work on a deployed machine but now I find that the report thinks the database is where it is on my developing computer.

I created the report using CRXI developer edition upgraded to v 11.5.122.1838. Then I used VS2012 (vb) to add a form on which I placed the CR viewer and associated it with the report I wanted. The report had the datasource set to F:\Projects\VB\Rentals\Bin\Debug\X.mdb which is where the dB was located while I was developing the project. The project worked perfectly on my machine but that's where it was developed so I would expect that. I then used Installshield 2010 to create a deployment package for the program. The target machine was freshly loaded with Windows 7/64. After installing the program I can bring up the CRviewer but I get a Database Login form which shows the server location as F:\Projects\VB\Rentals\Bin\Debug\X.mdb and the Database at the same location. This is incorrect. The actual location of the database is Program Files (x86)\MyProgram\X.mdb. It will never be able to log in because the location at which it thinks the database is located does not exist.

Is this a problem with the way I saved the report? How can I change the datasource on the client machine? I've seen several answers to this around the net but I'm afraid I did not understand what they were talking about at all. I'm so close now ... please help.

I suppose I could create the directory structure on my development machine that I intend to use on the deployed machines and then set the datasource on the report that way ... but perhaps there is a way to do this programmatically. And doing it that way will force the user to install the program to my exact location ... I'd like to let them choose where the program is installed.

Thanks

Ken

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Ken,

Possibly Lots of problems with what you are doing. It sounds like you are using the RDC and ActiveX viewer in your app? They have never been officially supported in any version of VS above VS 6.

And in current versions of VS the ActiveX viewer and embedded Report Designer are for use on your DEV PC only, you cannot redistribute them. None of our deployment packages include them.

So need more info, are you using the craxdrt.dll or craxddrt.dll in your VS Project?

Or are you using the CR .NET assemblies in your project?

If you are it's time to upgrade to CR for VS which is free to download, for redistributing see the licensing link on the Overview Tab.

You can download the installer from this link:

http://scn.sap.com/docs/DOC-7824

And the redist packages are there also.

The problem you are having is you are not updating the report database location at runtime, CR will not know if you don't code it into your app.

Don

Former Member
0 Kudos

Thanks for the reply Don. I have updated CR for VS as you mentioned ... I'm using VS2012 ... but I still find it easier to design a report using CRXI and then integrate it into my VS project. Perhaps the problem is the way I am integrating it. What I've been doing is designing the report and saving it as a .rpt. Then, in VS I add a new windows form and call it rptXXX.vb. On that form I place the CRViewer. In the load even for the form I use the following code:

Dim pth As String = ReportPath & "XXX.rpt"

        Dim paramFields As New CrystalDecisions.Shared.ParameterFields()

        'First Parameter

        Dim paramField As New CrystalDecisions.Shared.ParameterField()

        Dim paramRange As New CrystalDecisions.Shared.ParameterDiscreteValue()

        paramField.ParameterFieldName = "ReservationID" ' Parameter Name In Crystal Report

        paramRange.Value = ReservationID ' value For Parameter Field

        paramField.CurrentValues.Add(paramRange)

        paramFields.Add(paramField) ' To add parameter in parameterslist

        CrystalReportViewer1.ParameterFieldInfo = paramFields 'to pass parameter inf.to CRV

        With CrystalReportViewer1

            .ReportSource = pth

            .SelectionMode = Windows.Forms.SelectionMode.None

            .DisplayToolbar = True

            .ShowCopyButton = False

            .ShowExportButton = False

            .ShowGotoPageButton = False

            .ShowGroupTreeButton = False

            .ShowParameterPanelButton = False

            .ShowRefreshButton = False

            .ShowLogo = False

            .ShowPageNavigateButtons = True

            .ShowProgressAnimation(False)

            .ShowTextSearchButton = False

            .ShowZoomButton = False

            .ToolPanelView = ToolPanelViewType.None

            .Width = 900

        End With

        For Each c1 As Control In CrystalReportViewer1.Controls

            If c1.GetType Is GetType(CrystalDecisions.Windows.Forms.PageView) Then

                Dim pv As CrystalDecisions.Windows.Forms.PageView = c1

                For Each c2 As Control In pv.Controls

                    If c2.GetType Is GetType(TabControl) Then

                        Dim tc As TabControl = c2

                        tc.ItemSize = New Size(0, 1)

                        tc.SizeMode = TabSizeMode.Fixed

                    End If

                Next

            End If

        Next

    End Sub

I have been able to get the viewer to display in the deployed program but the datasource for the report is set to what it was when I created the report in CRXI. This limits the installation location for the program as I get an error when opening the viewer on the deployed computer because the report cannot find the database.

I'm sorry to say I have no idea which dll I might be using or if I might be using CR.NET assemblies. How can I find out?

I have been looking for a way to set the report database location at runtime but I have had no luck with that.

I did create the directory structure on my development computer and reset the database location in the report which worked on 1 deployed computer but that is very limiting in the installation procedure as the user must install it in only 1 location if the reporting is to work. I can do this if absolutely necessary, but it seems to me there ought to be a way to allow the user to install the program to whatever location they wish and the reporting ought to work from there. As you said .. this would require a runtime update of the database location ... I just don't know how to do that. Or it could be my way of adding the report to my project but I don't know how else to do it.

Thanks again.

Ken

0 Kudos

Hi Ken,

Try this, Open your report up in CR XI and on the Set Location menu option click on the Same As Report. It does mean all of your MDB's need to be in the same location as the RPT files but it should work for you:

There is no option/way to set location to the datasource in the properties of the viewer. This is one way to avoid having to open the report using the Dim rpt as Engine.ReportSource and setting the viewer to the Viewer.ReportSource = rpt

If you can't save the MDB's in the same location then the Engine is the only way around this.

Be sure to .Close and .Dispose of the report Objects once you are done with them.

Don

Answers (0)