How to use MyDAC components with FastReport 4.0?

edited 10:19AM in FastReport 4.0
Hello,
i use at the moment the test version from FastReport 4.0 to see wether my request can be fulfilled with FastReport. In my program i use the MyDAC component to connect to a MySQL database to read my data. What can i do to use my MyDAC Querys and Tables to ust it with FastReport.

When i go in FastReport to the Data Sheet i don't have any option to add my Tables or Databases from MyDAC. Can anyone help me?

Comments

  • edited 10:19AM
    Can nobody help me?
  • edited 10:19AM
    There is a way to use MyDAC, but u need the whole sources to recompile.

    U can introduce nearly every Delphi-Objects to FastReport.
    {******************************************}
    {                                          }
    {             FastScript v1.9              }
    {        MyDAC classes and functions       }
    {                                          }
    {******************************************}
    
    unit fs_imysrtti;
    
    interface
    
    {$I fs.inc}
    
    uses
      SysUtils, Classes, fs_iinterpreter, fs_itools, fs_idbrtti, db, DBAccess,
      MyAccess, DAScript, MyScript, MemDS;
    
    type
      TfsMYSRTTI = class( TComponent ); // fake component
    
    implementation
    
    type
      TFunctions = class( TfsRTTIModule )
      private
        function CallMethod( Instance : TObject; ClassType : TClass;
          const MethodName : String; Caller : TfsMethodHelper ) : Variant;
    
      public
        constructor Create( AScript : TfsScript ); override;
      end;
    
      { TFunctions }
    
    constructor TFunctions.Create( AScript : TfsScript );
      begin
        inherited Create( AScript );
        with AScript do
          begin
            with AddClass( TDAParam, 'TParam' ) do
            begin
    
            end;
            with AddClass( TDAParams, 'TParams' ) do
            begin
    
            end;
    
            with AddClass( TCustomDAConnection, 'TCustomConnection' ) do
              begin
              end;
    
            with AddClass( TCustomMyConnection, 'TCustomDAConnection' ) do
              begin
              end;
    
            with AddClass( TMyConnection, 'TCustomMyConnection' ) do
              begin
              end;
    
             with AddClass( TMemDataSet, 'TDataSet' ) do
               begin
               end;
    
             with AddClass( TCustomDADataSet, 'TMemDataSet' ) do
               begin
                 AddMethod( 'procedure Execute', CallMethod );
                 AddMethod( 'function Executing : boolean', CallMethod );
               end;
    
            with AddClass( TCustomMyDataSet, 'TCustomDADataSet' ) do
              begin
              end;
    
            with AddClass( TMyTable, 'TCustomMyDataSet' ) do
              begin
              end;
    
            with AddClass( TMyQuery, 'TCustomMyDataSet' ) do
              begin
              end;
    
            with AddClass( TDAScript, 'TComponent' ) do
            begin
    
            end;
            with AddClass( TMyScript, 'TDAScript' ) do
            begin
    
            end;
    
          end;
      end;
    
    function TFunctions.CallMethod( Instance : TObject; ClassType : TClass;
      const MethodName : String; Caller : TfsMethodHelper ) : Variant;
      begin
        Result := 0;
    
        if ClassType = TCustomDADataSet then
          begin
            if MethodName = 'EXECUTE' then
              TCustomDADataSet( Instance ).Execute;
            if MethodName = 'EXECUTING' then
              RESULT := TCustomDADataSet( Instance ).Executing;
          end;
    
      end;
    
    initialization
    
    fsRTTIModules.Add( TFunctions );
    
    finalization
    
    if fsRTTIModules <> nil then
      fsRTTIModules.Remove( TFunctions );
    
    end.
    

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.