Page 1 of 1

TMSconnection - strange behavior

Posted: Wed 30 Oct 2019 08:44
for example:
in design i set in object inspector:
loginprompt:=false;
password:='';

then in code:
{mscon:tmsconnection;s:string;}

s:='Provider=TDS;Data Source=localhost;User ID=sa;Password=123';
if mscon.LoginPrompt then showmessage('loginpromt is set to true') else showmessage('loginpromt is set to false');
//here is loginpromt of course false yet
mscon.ConnectString:=s;//here is automatically set loginprompt to true (ignores design settings, in constr there is no reason..)
if mscon.LoginPrompt then showmessage('loginpromt is set to true') else showmessage('loginpromt is set to false');
//here is loginpromt already true, no setting true is in constr, so why is automatically set to true ???
ShowMessage(mscon.ConnectString);
//here is connectionstring with password yet
mscon.Connect;
{here appears loginpromt dialog ! (even though it was set up in the design to false, and not set by connectstr)
in addition, password box is empty even though it was set up by connectsr !
}

Re: TMSconnection - strange behavior

Posted: Thu 31 Oct 2019 07:46
by paweld
Add to ConnectionString: Login Prompt=False
e.g.

Code: Select all

s:='Provider=TDS;Data Source=localhost;User ID=sa;Password=123;Login Prompt=False';
mscon.ConnectString:=s;
if mscon.LoginPrompt then 
showmessage('loginpromt is set to true') 
else 
showmessage('loginpromt is set to false');

Re: TMSconnection - strange behavior

Posted: Thu 31 Oct 2019 11:47
by Stellar
By default, the "Login Prompt" connection parameter is set to True. In your example, you use the connection string that doesn't contain the "Login Prompt" connection parameter, therefore, this parameter is set to the default value True.

Re: TMSconnection - strange behavior

Posted: Thu 31 Oct 2019 17:47
if the logic is such that by assigning a value to mscon.connectstring reset atributes set by design! (which are not set by connstr) to default values, then I don't understand, why password (set by connstr) is missing in loginpromt dialog....that is quite contradictory, that's at least pretty unexpected behavior, I'd rather say a logical error.

Re: TMSconnection - strange behavior

Posted: Mon 04 Nov 2019 13:51
by Stellar
By default, TMSConnectDialog does not automatically put the password into the text box and asks the user to enter it manually. For TMSConnectDialog to put the password into the text box, set the SavePassword property value to True.
For example:

Code: Select all

MSConnectDialog1.SavePassword := True;
MSConnection1.ConnectDialog := MSConnectDialog1;
MSConnection1.Connect;
We intentionally distribute TMSConnectDialog with source code so that the users can change it according to their needs.

Re: TMSconnection - strange behavior

Posted: Mon 04 Nov 2019 18:17
please try this:
MSCon.ConnectString:='Provider=SQLNCLI11.1;Integrated Security=SSPI;Persist Security Info=False;User ID="";Initial Catalog="";Data Source=(localdb)\v11.0;Initial File Name=""';//this is correct connection string working with adoconnection..., this you can generate by windows system dialog.
ShowMessage(MSCon.ConnectString);

you see "..Provider=SQLNCLI.1" - there is LOST "11" from "11.1" and then i got error:..provider not found... (i am working with *.udl files..to store settings).

So assigning connectionstr to msconnection not only reset some settings (unlike ado), but directly corrupt them !!!
- this is big problem !

Re: TMSconnection - strange behavior

Posted: Tue 05 Nov 2019 13:48
by Stellar
Thank you for the information. We fixed the issue with NativeClientVersion connection option being set from ConnectionString, and the fix will be included in the next SDAC build.

Re: TMSconnection - strange behavior

Posted: Tue 05 Nov 2019 14:39
thank you, i found another 2 problems and sent them with code example to support via form.

Re: TMSconnection - strange behavior

Posted: Mon 11 Nov 2019 14:28
by Stellar
We've sent the reply to these additional questions by email.