Page 1 of 1

MyconnectDialog user not set

Posted: Thu 20 Sep 2007 12:19
by chris SD
Hi, i have this problem with mydac 4.40, and now with de 5.10.0.10 delphi7 version. i set user (bad) and password (good) and loginprompt (false) property, but when i connect i trap the error and re connect with login prompt at true, in the connectdialog the user is not the bad user set in the Myconnection.username property. So i change the user (good), error again, cursor go to user label, only click ok and run fine. Its curious. Can i send you this connection test. The goal is to save connect information in tvappstorage of JVCL.

Here the link for example : http://www.system-d.fr/bug/bug_myconnectdialog.zip
This example use JVCL !

Posted: Fri 21 Sep 2007 07:39
by Antaeus
Does the problem persists if you do not use storages of JVCL?

Posted: Fri 21 Sep 2007 08:25
by chris SD
Hi,

Yes, without JVCL same process, so i try again and find my logic not good :oops:. I modify and all run fine.
Except that the user show in myconnectdialog is not the user set in myconnection.username ... but not very important.

Thanks.

here sample code :

procedure TDataModule1.DataModuleCreate(Sender: TObject);
begin
// the default property username is test
MyConnection1.username := 'tester'; // Not good
try
MyConnection1.connect;
except
try
showmessage (MyConnection1.username); // tester not good but ok
Showmessage (MyConnectDialog1.Connection.Username); // tester not good but ok
MyConnection1.LoginPrompt := True;
MyConnection1.connect; // show user test ?
except
showmessage ('Error');
end;
end;
end;

Posted: Fri 21 Sep 2007 08:35
by chris SD
With JVCL same result : The user show is not the username.property.

Else, thanks for your reply and very goods products.

Here the sample :

unit connect_udm;

interface

uses
SysUtils, Classes, JvComponentBase, JvFormPlacement, DBAccess, MyDacVcl,
DB, MyAccess, JvAppStorage, JvAppIniStorage, JvCipher;

type
TDataModule1 = class(TDataModule)
MyConnection1: TMyConnection;
MyConnectDialog1: TMyConnectDialog;
JvFormStorage1: TJvFormStorage;
Cipher: TJvVigenereCipher;
procedure DataModuleCreate(Sender: TObject);
procedure MyConnection1AfterConnect(Sender: TObject);
procedure JvFormStorage1SavePlacement(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;

var
DataModule1: TDataModule1;

implementation

{$R *.dfm}

uses connect_u1,dialogs;

procedure TDataModule1.DataModuleCreate(Sender: TObject);
begin
JvFormStorage1.RestoreFormPlacement;
try
MyConnection1.connect;
except
try
showmessage (MyConnection1.username);
Showmessage (MyConnectDialog1.Connection.Username);
MyConnection1.LoginPrompt := True;
MyConnection1.connect;
except
showmessage ('Error');
end;
end;
end;

procedure TDataModule1.MyConnection1AfterConnect(Sender: TObject);
begin
JvFormStorage1.SaveFormPlacement;
end;

// for a password crypted - its better ...
procedure TDataModule1.JvFormStorage1SavePlacement(Sender: TObject);
begin
Cipher.Decoded := Myconnection1.Password;
TJvFormStorage(sender).AppStorage.WriteString(TJvFormStorage(sender).AppStoragePath + 'Cipher', Cipher.Encoded);
end;

end.

Posted: Fri 21 Sep 2007 11:55
by Antaeus
Try to set the value of the TMyConnectDialog.StoreLogInfo property to False to resolve this problem.

Posted: Sat 22 Sep 2007 09:38
by chris SD
Thanks. It's the solution. All run fine now. :lol: