MyDAC components on a Datamodule in a Multi-Device Application

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ED-Clint
Posts: 36
Joined: Thu 18 May 2017 08:52

MyDAC components on a Datamodule in a Multi-Device Application

Post by ED-Clint » Tue 22 Aug 2017 06:44

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?

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

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

Post by ViktorV » Tue 22 Aug 2017 13:21

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

ED-Clint
Posts: 36
Joined: Thu 18 May 2017 08:52

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

Post by ED-Clint » Wed 23 Aug 2017 06:23

Hi Viktor,

I have sent you a test project showing the issue.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

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

Post by ViktorV » Wed 23 Aug 2017 11:11

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.

ED-Clint
Posts: 36
Joined: Thu 18 May 2017 08:52

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

Post by ED-Clint » Wed 23 Aug 2017 11:34

Thank you Viktor, this was exactly it.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

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

Post by ViktorV » Wed 23 Aug 2017 11:53

Thank you for the interest in our products.
Please contact us if you have any questions about our products.

Post Reply