TUniConnectDialog::Execute() results in access violation

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
AHS
Posts: 2
Joined: Fri 07 Jan 2011 12:16

TUniConnectDialog::Execute() results in access violation

Post by AHS » Fri 07 Jan 2011 12:46

Try to use UniDAC Pro 3.50.014 for RAD Studio XE in a C++ VCL project.

As test used a form with one button and a TUniConnectDialog on it.
The only code is the button click handling:

void __fastcall TForm1::Button1Click(TObject *Sender)
{ UniConnectDialog1->Execute(); }

When running a button click results only in an
Access violation at address 00380980 in module 'unidac150.bpl'. Read from address 000000EC.

That's it. :(

What to do, to get a simple connection dialog on screen in RAD Studio XE in a C++ VCL project?


(There is no problem to connet with design time connection by use of TUniConnection, TInterBaseUniProvider, TUniTable...)

AndreyZ

Post by AndreyZ » Mon 10 Jan 2011 15:11

Hello,

You should set the TUniConnection.ConnectDialog property to UniConnectDialog1 and then call the TUniConnection.Connect method.

AHS
Posts: 2
Joined: Fri 07 Jan 2011 12:16

Post by AHS » Tue 11 Jan 2011 08:03

Okay, works fine that way! :)


The help information should be a little bit more helpfull.
Have a look to my (your customers) view on it.

Description Execute method of TUniConnectDialog says:
"Displays the connect dialog and calls the connection's Connect method when user clicks the Connect button"
=> dialog calls UniConnection.Connect()
But which UniConnection object?
Description Connection property of TUniConnectDialog says:
"Points to the associated TUniConnection object. "
"Remarks
The Connection property points to the associated TUniConnection object. This property is read only. "
=> If there is a read only property to a TUniConnection object and there is no method to set it. (Let me think...) The dialog must create it as a sub object, cause it will call it's UniConnection.Connect() method! After the execution every one can get the UniConnection object from the dialogs property.

That leads to the wrong direction. The right solution is:
First set TUniConnection.ConnectDialog property to a TUniConnectDialog object. If TUniConnection.Connected property is false, call the Execute method of the TUniConnectDialog. A click on the connect button will call the UniConnection.Connect() method.
(Strange to me, that you introduce dialog object to connetion object. Than dialog object automaticly knows the connection object and can call its methodes.)

Thanks for quick solution.

AndreyZ

Post by AndreyZ » Tue 11 Jan 2011 10:34

Thank you for your inquiry. We will investigate this question.

Post Reply