TMSconnection - strange behavior
-
- Posts: 5
- Joined: Tue 11 Mar 2014 17:33
TMSconnection - strange behavior
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 !
}
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
Add to ConnectionString: Login Prompt=False
e.g.
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
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.
-
- Posts: 5
- Joined: Tue 11 Mar 2014 17:33
Re: TMSconnection - strange behavior
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
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:
We intentionally distribute TMSConnectDialog with source code so that the users can change it according to their needs.
For example:
Code: Select all
MSConnectDialog1.SavePassword := True;
MSConnection1.ConnectDialog := MSConnectDialog1;
MSConnection1.Connect;
-
- Posts: 5
- Joined: Tue 11 Mar 2014 17:33
Re: TMSconnection - strange behavior
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 !
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
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.
-
- Posts: 5
- Joined: Tue 11 Mar 2014 17:33
Re: TMSconnection - strange behavior
thank you, i found another 2 problems and sent them with code example to support via form.
Re: TMSconnection - strange behavior
We've sent the reply to these additional questions by email.