locked
Change Timberline Data Source at Runtime RRS feed

  • Question

  • Hello I have built some reports against a Timberline ODBC datasource. I designed the reports in Crystal 11 and everything works fine. I use an ODBC Connection and enter a connection string like

    Driver=Timberline Data;dbq=E:\\Program Files\\Timberline Office\\Accounting\\Construction Sample Data\\;codepage=1252;dictionarymode=1;standardmode=1;maxcolsupport=1536;shortennames=1;databasetype=1

    In the crystal designer the report works fine. Opening the report in my application on my local machine is all fine as well. I use the ReportDocument class and the CrystalReportViewer.

    However, the connection information needs to be changed programatically. I need to programatically change the above connection string to point to different data. How?

     foreach (CrystalDecisions.CrystalReports.Engine.Table tbl in rptDoc.Database.Tables)
                    {
                        logOnInfo = tbl.LogOnInfo;

                        logOnInfo.ConnectionInfo.?????????? - What properties do i need to set???? There is no ConnectionString property here. The only things i can set are the user and pass and database etc.

                        tbl.ApplyLogOnInfo(logOnInfo);
                    }
                    
                    SubreportObject subRptObj = null;

                    foreach (CrystalDecisions.CrystalReports.Engine.Section sec in rptDoc.ReportDefinition.Sections)
                    {
                        foreach (ReportObject rptObj in sec.ReportObjects)
                        {
                            if (rptObj.Kind == CrystalDecisions.Shared.ReportObjectKind.SubreportObject)
                            {

                                subRptObj = (SubreportObject)rptObj;
                                ReportDocument subRptDoc = subRptObj.OpenSubreport(subRptObj.SubreportName);

                                foreach (CrystalDecisions.CrystalReports.Engine.Table tbl in subRptDoc.Database.Tables)
                                {

                                    logOnInfo = tbl.LogOnInfo;

                        logOnInfo.ConnectionInfo.?????????? - What properties do i need to set???? There is no ConnectionString property here. The only things i can set are the user and pass and database etc.

                        tbl.ApplyLogOnInfo(logOnInfo);
                                
                                }
                            }
                        }
                    }

    I have tried everything and i cant get it to connect. Help is much appreciated. Thanks


    DevelopingFL
    Friday, July 15, 2011 8:57 PM

Answers

  • Hello,

    No it does not, any full version of CR 9 up to CR 2008 above will include it. If you upgrade to Visual Studio 2010 you can download the full version of CR for VS 2010 which also includes it now. CR 2011 does not include the SDK.

    You can get CR from http://store.businessobjects.com/store/bobjamer/DisplayProductByTypePage&parentCategoryID=&categoryID=54722300

    And if you upgrade to VS 2010 you can get the free CR for VS 2010 and runtime from:

    http://www.sdn.sap.com/irj/boc/crystalreports-dotnet

    Bottom of the page....

    Don


    Don Williams
    • Marked as answer by aramka Friday, July 22, 2011 8:00 PM
    Friday, July 22, 2011 7:52 PM

All replies

  • Hello,

    Create a new report off the new database and then run this in your app in debug mode and stop on the get connection properties. You should be able to see what the new connection string should look like.

    Thanks

    Don


    Don Williams
    Friday, July 15, 2011 9:52 PM
  • Hello SAPDon,

    Thanks for your reply.

    I know what the connection string should look like, the problem is how can i set the connection string? There is no way to set the connection string property from the report document. I need to be able to programatically change the connection string. The report needs to be able to move with my application. I build the connection string programatically based on configuration settings then i need to be able to set the report to use the connection string i build at runtime.

    How can i set the reports connection string @ runtime?


    DevelopingFL
    Sunday, July 17, 2011 8:40 AM
  • Set up a new DSN to the new server and set the log on info, DSN, Database, User, Password. Connection info is read from the DSN, so as long as it's configured properly it should work.

    Then VerifyDatabase to confirm it updates the references in the report.

    If you have access to RAS, requires a full version of CR runtime, not the CR basic for VS, then search SAP Forums for "ReplaceConnection_Click" and you'll find sample code on how to use that method to completely replace/update the connection info.

    Don


    Don Williams
    Monday, July 18, 2011 2:52 PM
  • Thank your for your reply and help.

     

    Setting up a DSN is not a solution in this case. I have several hundred users who use this application. Setting up a DSN for each users machine is not feasible. I do not have control of the user machines and even if i did setting up a DSN for each existing user and future users is not practical.

     

    Again i thank you for your suggestions and help.


    DevelopingFL
    Wednesday, July 20, 2011 2:00 PM
  • Hi,

    Try this to see what RAS gets for your connection string info and property bag:

    1553921 - Is there a utility that would help in writing database logon code?

    You can compare old and new reports to see what the differences are and make the necessary changes.

    Don

     


    Don Williams
    Wednesday, July 20, 2011 2:37 PM
  • Hello and thanks again for your help.

     

    I was able to change the connection string with the classes and namespaces within the CrystalDecisions.ReportAppServer. Everything works great on my development machine.

    However, when i deploy the app to another machine i get the following exception:

     

    An error has occurred while attempting to load Crystal Reports runtime.

     

    Either the Crystal Reports registry key permissions are insufficent of the Crystal Reports runtime is not installed correctly.

     

    Please install the appropriate Crystal Reports redistributable (CRRedist*.msi containing the correct version of the CrystalReports runtime(x86,X64, or Itanium required. Please go to .......

     

    My users will not have a crystal Replyreports license. Where can i find a redistributable package?


    DevelopingFL
    Thursday, July 21, 2011 8:44 PM
  • Great to see you have it all working now...

    For licensing and deployments see this Blog by Blair Wheadon who is a Solution Manager at SAP and manages the licensing side of our Products:

    http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/24199

    Thank you

    Don


    Don Williams
    Thursday, July 21, 2011 8:51 PM
  • Does the

    Crystal Reports Basic for Visual Studio .NET 2008

     

    include the CrystalDecisions.ReportAppServer assemblies?

     

    If not where can i find the redistributable that includes the CrystalDecisions.ReportAppServer assemblies?


    DevelopingFL
    Friday, July 22, 2011 6:06 PM
  • Hello,

    No it does not, any full version of CR 9 up to CR 2008 above will include it. If you upgrade to Visual Studio 2010 you can download the full version of CR for VS 2010 which also includes it now. CR 2011 does not include the SDK.

    You can get CR from http://store.businessobjects.com/store/bobjamer/DisplayProductByTypePage&parentCategoryID=&categoryID=54722300

    And if you upgrade to VS 2010 you can get the free CR for VS 2010 and runtime from:

    http://www.sdn.sap.com/irj/boc/crystalreports-dotnet

    Bottom of the page....

    Don


    Don Williams
    • Marked as answer by aramka Friday, July 22, 2011 8:00 PM
    Friday, July 22, 2011 7:52 PM