Operation not possible

Hello,

i tried to print the MasterData1 without any data. I found that i must use Scriptcode in the report.

In the first step i removed the DataSet from the MasterData1-Band and put the following code into the Code-Tab:
var
ds: TfrxDataSet;

begin
  ds := Report.GetDataset('frxDBDataset1');
       MasterData1.DataSet := ds;
end.

In this step everything works fine for the "normal"-Output with Data...

The i tried the following Code:
var
ds: TfrxDataSet;

begin
  ds := Report.GetDataset('frxDBDataset1');
     if ds.recordcount = 0 then
       begin                          
        MasterData1.DataSet := nil;
        MasterData1.RowCount := 1;
       end                         
    else
       begin                         
        MasterData1.DataSet := ds;
        MasterData1.RowCount := 0;
       end;                           
end.

Then the report will work, if the Dataset is empty. But when the Dataset hold some Data i get the error: [0x0005] Operation not possible.

What is here wrong? Can anyone help me?

Thanks a lot

Andreas

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 4:03PM
    what version and build# of fr
    i can't reproduce here
    d14, fr4.9.99
    your code runs fine.
  • edited July 2010
    Hello gordk,

    thank you for your fast answer...

    I reinstalled FR with the version 4.9.99 Prof. (How can i see the Build-Version of the installed FR?)

    my Delphi 2007 Prof. is Version 11.0.2902.10471

    The report will still not work with the code inside...

    Regards
    Andreas
  • edited 4:03PM
    Hello again,

    i found the solution for this error. It did not come from FR... Is still comes from the dbexpress-component in Delphi. I use the dbExpress driver for mySQL from devart. Reading RecordCount will generate an exception...

    Read more here: http://dn.codegear.com/article/28494

    Regards
    Andreas

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.