Cast Sqlite Connection

StarkStark Syria
edited April 2010 in FastReport .NET
Hi , have a good day


When ever this code executing I got the error message as the Attachment picture explain ...
FastReport.Data.SQLiteDataConnection ReportConnection = (FastReport.Data.SQLiteDataConnection)fastreport.FindObject("Connection");
ReportConnection.Restrictions = Restrictions.HideAllProperties;

I wonder if there is a way to get around this error
or is there is another way to hide connection properties

P.S :
My Report is work ( 100 % ) Fine with out the above code ,

Kind regards ,

Comments

  • edited April 2010
    Hello,

    As you can see, there are two copies of the same dll (FastReport.SQLite.dll). One is included into your project and the second is used in FastReport. You may do it easier:
    FastReport.Data.DataConnectionBase ReportConnection = (FastReport.Data.DataConnectionBase)fastreport.FindObject("Connection");
    ReportConnection.Restrictions = Restrictions.HideAllProperties;
    

    In this case, you don't need to include a reference to FastReport.SQLite.dll into your project.
  • StarkStark Syria
    edited April 2010
    Thank you , Alex , that solve my problem ...


    Another thing I wish you try it ,,,

    try to deploy a WinForm Application with Fast Report that using "SQLiteDataConnection" as DataSource , On ( a Clean Machine )

    it's really painful ,

    * every time I deploy it , I should edit the FastReport Config file , in "..\..\AppData" folder , and add the plug in manually
    Otherwise , I will got message "Missing Object SqliteDataConnection"

    Even if the Fastreport.sqlite.dll in GAC or in the same application folder ...

    And yes
    FastReport.Utils.RegisteredObjects.AddConnection(typeof(SQLiteDataConnection));
    
    Had the same issue


    however , I solved it by Including the SqliteConnection Classes , into FastReport Source Code and rebuild it ...

    And every thing work fine , with out the pain of editing FastReport Config

    Thank you , in advance ,,,
  • edited 3:47PM
    Sorry, I don't understand what is the problem. The following way (from readme.txt) must solve it completely:
    3) register the dll programmatically
    - add the "FastReport.SQLite.dll" reference to your project;
    - execute the following code once at the application start:
    FastReport.Utils.RegisteredObjects.AddConnection(typeof(SQLiteDataConnection));
    

    and, don't use config file in this case.
  • StarkStark Syria
    edited April 2010
    AlexTZ wrote: »
    Sorry, I don't understand what is the problem. The following way (from readme.txt) must solve it completely:
    3) register the dll programmatically
    - add the "FastReport.SQLite.dll" reference to your project;
    - execute the following code once at the application start:
    FastReport.Utils.RegisteredObjects.AddConnection(typeof(SQLiteDataConnection));
    

    and, don't use config file in this case.

    it's strange for me too ,
    My Application work fine inside Visual studio
    Once I copy it , to another location , It's fail and said "Missing Object SqliteDataConnection"
    even if the all the Dll's in the same folder of My Application
    I will build an example for this case ,

    thank you for your support ....
  • edited 3:47PM
    You probably do this too late, after the report is loaded:
    FastReport.Utils.RegisteredObjects.AddConnection(typeof(SQLiteDataConnection));
    
    Try to move this code to the Program.cs file, for example:
        static void Main()
        {
          Application.EnableVisualStyles();
          Application.SetCompatibleTextRenderingDefault(false);
          FastReport.Utils.RegisteredObjects.AddConnection(typeof(SQLiteDataConnection));
          Application.Run(new Form1());
        }
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.