Page 1 of 1

SDAC and FastReport 4 problems

Posted: Thu 25 Oct 2007 21:00
by carlr
Hi!

Im testing SQL Server components for delphi 2006 with the trial (so i assume its the last version). The test is to replace all my ADO queries / connection by the SDAC SQL components and its going very well.

Im doing the same thing with FastReport. I add the "SDAC" components in the unit where tfrxReport is, assigning the default database, changing ADO queries to SDAC queries. For a simple report, it works perfectly.

But in a report im using some code in beforeprint event and when i try to work with SDAC components, FR give me "unknown type : TfrxSDACQuery". Is this a limitation ? is this a bug ? is this because im using the trial version ? cause with ADO / BDE / INTERBASE components from FR there is no problem to do that...

Someone have an idea why i have this bug ?

there are the version im using : FR -> 4.3.66 / Delphi 2006

Posted: Mon 29 Oct 2007 09:10
by Antaeus
Thank you for information. We are investigating this problem. As soon as we have any results, or we need more information, we will let you know.

Posted: Tue 30 Oct 2007 09:04
by Antaeus
Have you installed SDAC Engine for FastReport 4? You will find its packages in the following directory: SDAC_InstDir\Demos\Win32\ThirdParty\FastReport\FR4\Delphi10\ directory.
SDAC_InstDir is the SDAC installation directory on your computer.

If these packages are installed, but the problem in your application still persists, try to reproduce it with SDAC demo for FastReport. You will find it near the packages.

Posted: Tue 30 Oct 2007 12:30
by carlr
yes i installed FastScript and FrxSDAC components. I also tried your demo before replacing my FR ADO components, and yes the demo is working.

The problem is that our queries are in the report, not in a form in the software like your demo. So thats why we need sometimes to write code in order to build a report ( custom filter in the report, for an example ). And when we trying to set the SQL property, FR said that he doesnt know the TfrxSDACQuery object. And i know sometimes parameters can do the job, but when your building a custom WHERE clause, parameters is not applying here.

Posted: Thu 01 Nov 2007 10:39
by Antaeus
Does the problem appear in the FastReport demo of SDAC if you change it in the way you need?
If it does, provide the exact steps to reproduce the problem with this demo. If it does not, send me a complete small sample to reproduce the problem, including script to create server objects if it is necessary.
Also specify the exact SDAC version you are using.

Posted: Thu 01 Nov 2007 16:04
by carlr
Ive done many tests and here is what i see :

- If you create a new project with fr components, building the report with the filter assignment in the code, without saving the project, it will do the error.
- If you create a new project with fr components, building the report with the filter assignment in the code, saving the project, it will do the error.
- If you create a new project with fr components, building the report with the filter assignment in the code, saving the project, closing the project, reopen it, retry it WONT DO the error !!?!.
- If you create a new project with fr components, building the report with the filter assignment in the code, saving the project, closing the project, closing Delphi, reopen delphi, reopen the project, delphi said the following error from Delphi IDE : "Class TfrxSDACQuery not found"... with the box "Ignore / Cancel / Ignore All", and it will do the error.

I tried also to add a query in your demo, add the filter and it does the same behavior.

I decided to reinstall CoreLabs components and retry it. With your Demo and with a new project, it is doing the same behavior.

The problem is very easy to reproduce. Here are the steps :

1- Create a new projet in delphi
2- Add TfrxReport component
3- Add TMSConnection, and configure it on the database you want
3- Add TfrxSDACComponents, and set the value of the property "DefaultDatabase" to your connection in the form.
4- Go in the FR Designer, and create a new report.
5- Add a TfrxSDACQuery, and set a SELECT clause on any table, like

SELECT * FROM OBJECT

6- Set SDACQuery1 as the data provider for you masterdata row in the report, and add some field in the masterdata row.

*** As this point, is you try to view the report, everything is working fine, its kinda like your demo.

7- Now, add a dialog form. In the dialog form, put a button. Set the modalresult button to "mrOk". On the "OnClick" event for the button, your gonna write a filter for you SDACQuery1 created before, like :

procedure Button1OnClick(Sender: TfrxComponent);
begin
SDACQuery1.Filter := 'ID>10';
SDACQuery1.Filtered := true;
end;

8- If you try to view the report with that code in your report, FR said the following error in the script : "unknown type : TSDACQuery"

So thats how you reproduce the problem.

What i thinking : from the behaviors im seeing, and the difference in the code with the frxDACcomponents.pas unit ws FR data components, you are not initializing components as FR does with ADO / IBX / etc. Maybe the problem starts there...

Here are the versions of what im using :

FastReport 4 : 4.3.66
Delphi 2006 : Borland® Developer Studio for Microsoft® Windows™ Version 10.0.2288.42451 Update 2
CoreLab : 4.30.0.12 (20.09.07) if i check you history file, and its the 60-day trial
Database : SQL Server 2000 / 2005 (im testing on both)

Posted: Mon 05 Nov 2007 16:43
by Antaeus
It looks like you have not setup IDE paths correctly. Add the following paths to the "Library Path" of your IDE:
  • %SDAC%\Demos\Win32\ThirdParty\FastReport\FR4\
  • %SDAC%\Demos\Win32\ThirdParty\FastReport\FR4\Delphi11 // this path must contain *.bpl files of the FastReport packages
%SDAC% is the SDAC installation path on your computer.

Posted: Tue 06 Nov 2007 14:28
by carlr
Antaeus wrote:It looks like you have not setup IDE paths correctly. Add the following paths to the "Library Path" of your IDE:
  • %SDAC%\Demos\Win32\ThirdParty\FastReport\FR4\
  • %SDAC%\Demos\Win32\ThirdParty\FastReport\FR4\Delphi11 // this path must contain *.bpl files of the FastReport packages
%SDAC% is the SDAC installation path on your computer.
Alright here is what i did :

- uninstall frxSDAComponents
- Resinstall it without changing any params (i.e .bpl files are going in the My documents\Borland...\BPL when we compiling / installing packages)
- Copy .bpl / .dcp files in %SDAC%\Demos\Win32\ThirdParty\FastReport\FR4\Delphi10 directory
- Set search path in Options to add "%SDAC%\Demos\Win32\ThirdParty\FastReport\FR4" and "%SDAC%\Demos\Win32\ThirdParty\FastReport\FR4\Delphi11"

Results ->Delphi is not rising an exception for not recognizing the components, but in FR designer, its doing the same problem, I.E. "unknown type : TfrxSDACQuery"

2nd test -> copying .bpl in %FR%\LibD10, and installing the packages from there. Works in Delphi, but doing the same bug in FR designer...

After some try/except :P, here is what i did to make it work...

- In the frxDACComponents.pas unit, in the RegisterDacComponents function, i made these changes:

procedure RegisterDacComponents(Components: TfrxDACComponentsClass);
begin
//frxObjects.RegisterCategory(Components.GetComponentsName, Components.GetComponentsBitmap, Components.GetComponentsName + ' Components');
frxObjects.RegisterObject1(Components.GetDatabaseClass, nil, '', {Components.GetComponentsName}'', 0, 37);
frxObjects.RegisterObject1(Components.GetTableClass, nil, '', {Components.GetComponentsName}'', 0, 38);
frxObjects.RegisterObject1(Components.GetQueryClass, nil, '', {Components.GetComponentsName}'', 0, 39);
end;

- i did a fresh install, with just adding directory to the new project
- Recompile it, and it works !!!

Im really not sure if its the solution to the problem or not, and i didnt test it on like 15 reports, and working with it for a week or 2 to made this "100% efficient", so maybe you can check that and see what you can do with this ;)

Posted: Tue 06 Nov 2007 16:02
by carlr
carlr wrote: After some try/except :P, here is what i did to make it work...

- In the frxDACComponents.pas unit, in the RegisterDacComponents function, i made these changes:

procedure RegisterDacComponents(Components: TfrxDACComponentsClass);
begin
//frxObjects.RegisterCategory(Components.GetComponentsName, Components.GetComponentsBitmap, Components.GetComponentsName + ' Components');
frxObjects.RegisterObject1(Components.GetDatabaseClass, nil, '', {Components.GetComponentsName}'', 0, 37);
frxObjects.RegisterObject1(Components.GetTableClass, nil, '', {Components.GetComponentsName}'', 0, 38);
frxObjects.RegisterObject1(Components.GetQueryClass, nil, '', {Components.GetComponentsName}'', 0, 39);
end;

- i did a fresh install, with just adding directory to the new project
- Recompile it, and it works !!!

Im really not sure if its the solution to the problem or not, and i didnt test it on like 15 reports, and working with it for a week or 2 to made this "100% efficient", so maybe you can check that and see what you can do with this ;)
Forget about that post, cause i made it bug again :( but i found an interesting thing when i was trying the solution i posted earlier...

It seems that the creation order is rly important for making thing working in FR designer.

- If you drag TfrxReport, then TfrxSDACComponents, you'll have the bug in the designer.
- If you reverse this (TfrxSDACComponents first, TfrxReport 2nd), you WONT have the bug in the report...

i closed Delphi, restarted it, retried it and it is doing the same behavior in both cases... and changing the "RegisterCategory" function isnt changing anything in the process. So far its working fine, but i dunno if it the problem is "patched" by doing this or solved.

Posted: Fri 09 Nov 2007 16:51
by Antaeus
Does it mean that you fixed the problem by changing code in the frxDACComponents unit?
From this:

Code: Select all

  frxObjects.RegisterCategory(Components.GetComponentsName, Components.GetComponentsBitmap, Components.GetComponentsName + ' Components');
  frxObjects.RegisterObject1(Components.GetDatabaseClass, nil, '', Components.GetComponentsName, 0, 37);
  frxObjects.RegisterObject1(Components.GetTableClass, nil, '', Components.GetComponentsName, 0, 38);
  frxObjects.RegisterObject1(Components.GetQueryClass, nil, '', Components.GetComponentsName, 0, 39);
To this:

Code: Select all

  frxObjects.RegisterObject1(Components.GetDatabaseClass, nil, '', '', 0, 37);
  frxObjects.RegisterObject1(Components.GetTableClass, nil, '', '', 0, 38);
  frxObjects.RegisterObject1(Components.GetQueryClass, nil, '', '', 0, 39);

Posted: Mon 03 Dec 2007 22:57
by carlr
Sorry for posting that late.


As i posted november 6, 2ns post
Forget about that post, cause i made it bug again :( but i found an interesting thing when i was trying the solution i posted earlier...

It seems that the creation order is rly important for making thing working in FR designer.

- If you drag TfrxReport, then TfrxSDACComponents, you'll have the bug in the designer.
- If you reverse this (TfrxSDACComponents first, TfrxReport 2nd), you WONT have the bug in the report...

i closed Delphi, restarted it, retried it and it is doing the same behavior in both cases... and changing the "RegisterCategory" function isnt changing anything in the process. So far its working fine, but i dunno if it the problem is "patched" by doing this or solved.
So removing the category is making things working, but only while your delphi is not closed. If you close/open, bug is still there. But changing creation order of the TfrxReport / TfrxSDACComponents components is making things working at each time...