Page 1 of 1

MyDAC components on a Datamodule in a Multi-Device Application

Posted: Tue 22 Aug 2017 06:44
by ED-Clint
Hi,

Hopefully you can help me, maybe I am doing something wrong here!

I create a new Multi-Device Application, select Tabbed with Navigation in RAD Studio Tokyo 10.2.
I add an Edit box on the first page and then add a datamodule. On the datamodule I add a function that returns a string. On the first page I call the function in the datamodule and display the result string in the Edit box. So far so good.

I add a TMyConnection to the datamodule and simply set the parameters, Server, Username, Password and database. I do not try an connect or do anything else with this component, just set those 4 parameters.

I leave the result as a simple string and add a try except returning the E.Message as the string if it excepts.

It excepts every time with an Access violation. I can have the TMyConnection on the datamodule as long as I do nothing with it, as soon as I try to do anything with the TMyConnection I get the Access Violation.

Is this expected? Why?
Is there anything other information I can provide?

Re: MyDAC components on a Datamodule in a Multi-Device Application

Posted: Tue 22 Aug 2017 13:21
by ViktorV
Unfortunately, we cannot reproduce the issue.
In order to get a detailed answer, please compose a small sample demonstrating the issue and send it to usvia form e-support: https://www.devart.com/company/contactform.html

Re: MyDAC components on a Datamodule in a Multi-Device Application

Posted: Wed 23 Aug 2017 06:23
by ED-Clint
Hi Viktor,

I have sent you a test project showing the issue.

Re: MyDAC components on a Datamodule in a Multi-Device Application

Posted: Wed 23 Aug 2017 11:11
by ViktorV
This error is not related to MyDAC functionality, but to your application architecture. The error occurs due to the fact that when calling your DataModule1.ThisIsADM function in the TTabbedwithNavigationForm.FormCreate method the TDataModule class is not created yet. You can make sure in it by executing the code line Self.Tag := 1 in your function. To solve the issue, you can add the line if Assigned(Self) then to your function.

Re: MyDAC components on a Datamodule in a Multi-Device Application

Posted: Wed 23 Aug 2017 11:34
by ED-Clint
Thank you Viktor, this was exactly it.

Re: MyDAC components on a Datamodule in a Multi-Device Application

Posted: Wed 23 Aug 2017 11:53
by ViktorV
Thank you for the interest in our products.
Please contact us if you have any questions about our products.