GetSQLCredentials Method
Syntax
Context.Session.GetSQLCredentials as L (ByRef Username as C, ByRef Password as C)
Arguments
- UsernameCharacter
The variable to receive the value of the SQL username.
- PasswordCharacter
The variable to receive the value of the SQL password.
Returns
- resultLogical
Always returns .t.. Check Context.Session.CallResult.Success before using the return value.
Description
Returns the SQL username and password used for SQL connections.
Discussion
Context.Session.GetSQLCredentials() method gets the current user name and password for SQL connections in the current session. Context.Session.SetSQLCredentials() must previously have been called. Check Context.Session.CallResult.Success before using the return value.
Example
<%a5 dim UsernameIn as c = "ThisIsMyUsername" dim PasswordIn as c = "ThisIsMyPassword" dim UsernameOut as c = "" dim PasswordOut as c = "" ? "Original username: " + UsernameIn + "<br/>" ? "Original password: " + PasswordIn + "<br/>" ? "<br/>" Context.Session.SetSQLCredentials(UsernameIn,PasswordIn) if Context.Session.CallResult.Success ? "Credentials have been set into the session<br/>" ? "<br/>" Context.Session.GetSQLCredentials(UsernameOut,PasswordOut) if Context.Session.CallResult.Success ? "Retrieved username: " + UsernameOut + "<br/>" ? "Retrieved password: " + PasswordOut+ "<br/>" ? "<br/>" if (UsernameIn == UsernameOut) .and. (PasswordIn == PasswordOut) then ? "<font color=\"green\">TEST PASSED</font>" else ? "<font color=\"red\">TEST FAILED</font>" end if else ? "<font color=\"red\">Error getting credentials</font>" end if else ? "<font color=\"red\">Error setting credentials</font>" end if %>
See Also