![]() |
3 errors with FIreDAC - Printable Version +- Atozed Forums (https://www.atozed.com/forums) +-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html) +--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html) +---- Forum: English (https://www.atozed.com/forums/forum-16.html) +----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html) +----- Thread: 3 errors with FIreDAC (/thread-3071.html) |
3 errors with FIreDAC - raulevm - 03-16-2023 Dear, use delphi 11.2.1 and IW 15.2.69 1.- FireDAC doesn't work with a data module in IW, only if I put the components in the IWUserSession or in the IWForms it works fine. 2.- I have a mandatory required field (required=true in IW). When deleting a record (FDQuery.delete) a message appears asking you to enter the required field. 3.- I have a non-null field from a SQL Server database (required=false in IW so that it doesn't give me problems). When deleting the record I get an error message that you need to enter the required field. The only way to solve this is by setting required=False and in the database that the field allows entering null values. I don't know if this only happens to me but since I don't have time to find out and the IntraWeb documentation is so bad, it can't work with FireDAC or it simply can't work with IntraWeb RE: 3 errors with FIreDAC - Mikael Nilsson - 03-16-2023 Hi, Do you create a separate datamodule? You should not do that. All FD components should be in UserSession form. A unique UserSession is created for each user. unit UserSessionUnit; { This is a DataModule where you can add components or declare fields that are specific to ONE user. Instead of creating global variables, it is better to use this datamodule. You can then access it using UserSession. } RE: 3 errors with FIreDAC - raulevm - 03-16-2023 Thanks for answering. In the old intraweb documentation (the only one there is from 20 years ago), the examples I use, forum readings, and people using IW all indicate that a data module can be used. There is no documentation that says that FireDAC cannot be used with a data module. Thank you RE: 3 errors with FIreDAC - DanBarclay - 03-18-2023 (03-16-2023, 02:17 PM)raulevm Wrote: Thanks for answering. In the old intraweb documentation (the only one there is from 20 years ago), the examples I use, forum readings, and people using IW all indicate that a data module can be used. There is no documentation that says that FireDAC cannot be used with a data module. Thank you A datamodule can be used, you just need to create the datamodule within the UserSession module. This makes it a part of the session. Dan RE: 3 errors with FIreDAC - Mikael Nilsson - 03-18-2023 (03-18-2023, 03:35 AM)DanBarclay Wrote:(03-16-2023, 02:17 PM)raulevm Wrote: Thanks for answering. In the old intraweb documentation (the only one there is from 20 years ago), the examples I use, forum readings, and people using IW all indicate that a data module can be used. There is no documentation that says that FireDAC cannot be used with a data module. Thank you Please explain why you want an extra Datamodule. RE: 3 errors with FIreDAC - DanBarclay - 03-20-2023 (03-18-2023, 12:52 PM)Mikael Nilsson Wrote:UserSession (TUserSession) is a very special data module. You get to determine the contents of it, and it is available per session at runtime. That is, each session has its own copy of UserSession. IW completely manages the creation/destruction/visibility of UserSession. You can create your own data module, then make it a part of UserSession like:(03-18-2023, 03:35 AM)DanBarclay Wrote:(03-16-2023, 02:17 PM)raulevm Wrote: Thanks for answering. In the old intraweb documentation (the only one there is from 20 years ago), the examples I use, forum readings, and people using IW all indicate that a data module can be used. There is no documentation that says that FireDAC cannot be used with a data module. Thank you Code: Type Doing that makes your datamodule available, but a part of UserSession. UserSession.myDataMod.... I'm not sure of Firedac requirements, you may be able to share a common connection but I suspect including the connection (per session) in the data module would be more robust. THere are a number of demos online with data connections and I believe they may be using datamodules. Dan RE: 3 errors with FIreDAC - Alexandre Machado - 03-21-2023 I responded via email, but here it goes: 1) When the user gets a timeout. Intraweb shows a error 500. (works perfectly in SA) Please check the item 8 in this document: https://docs.atozed.com/Docs.dll/deployment/isapi/Deploying%20ISAPI%20using%20IIS.html From that document: Quote:When deploying ISAPI applications in Windows servers and a time-out error occurs, you will probably get an error page like this: 2) I have tried to build a 64bit version of my application. But it only shows a white webpage instead of Login page. Does this work when building as SA? Is this specific when you deploy to IIS? IntraWeb has no issues when building as 64 bits. If this is specific to IIS, it may be related to the configuration of the application pool when deploying it. That same document above has detailed information on how to deploy it to IIS. If not, can you please try a simple test case application built from scratch using the IntraWeb application wizard? Put a single TIWButton on it and build it as 64 bits. See how it behaves. 3) I always used the UserSession for my database components (FireDac). Is this not correct? There is nothing wrong in putting your FireDac Database components in the UserSession. What we recommend is not putting *everything* related to the data access (i.e. all queries and other datasets) in the same place (or the UserSession). It makes things harder to maintain and also the memory consumption is higher (because every component instance is "alive" all the time). On the other hand, splitting the components into DataModules makes things more manageable and if you create and destroy them as needed, you make your application lighter (i.e. it will use less memory). Of course this needs to be considered on a case-by-case basis. These two demos show the concept of using DataMoudules to organize the data access components (queries, etc). Please have in mind that not everything in these demos is a rigid recipe to create IW DB applications. But they show some concepts that can be useful to your application. https://github.com/Atozed/IntraWeb/tree/master/15/Delphi/Database/IWADODBDemo https://github.com/Atozed/IntraWeb/tree/master/XIV/Delphi/Database/IWADOPool/source RE: 3 errors with FIreDAC - raulevm - 03-26-2023 Thanks for the help, I was able to fix the problem by following this help url: https://docs.atozed.com/docs.dll/getting%20started/User%20Session%20Overview.html I have changed my connection component structure to include only the FDConnection in the UserSession, and the other FDQuery components in the other data modules. In each data module I reference the ServerController to assign the connection property of each FDQuery at runtime, using the UserSession variable: Code: FDQuery1.Connection := UserSession.FDConnection1; And in each IWForm I assign the DataSet: Code: implementation |