splay
Posts: 58
Joined: Tue May 15, 2007 6:09 pm

SQL Windows Authentication

Fri Jan 18, 2008 4:35 pm

Hi,

Is it possible to add "Windows Authentication" as an option on the SQLConnectionDlg ?

THanks

Oh.. Any tutorial would be great :)

Thanks

Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact:  Website

Mon Jan 21, 2008 9:42 am

Hi,

This can be done by using a Custom SQL Connection in the "SQL Scripts" page. Here are the steps:
- for the custom SQL connection you set the "Connection String" field to:

Code: Select all

Driver={[ODBC_RES_PROP]};Server=[SERVER_PROP];Port=[PORT_PROP];Uid=[USERNAME_PROP];[PASS_SEG]Database=[DATABASE_PROP];[TRUSTED_PROP]
(this sets the SQL connection to use the values given by the user in the SQLConnectionDlg dialog)
- in the "Dialogs" page you select the "SQLConnectionDlg" dialog and add the Windows Authenticate checkbox (a simple checkbox with the text set to "Windows Authentication")
- in the "Properties" section you set the property of the checkbox to CHECK
- now you need to set the values of the [PASS_SEG] and [TRUSTED_PROP] properties (if they will be used) by using control events
- for the "Next" button you add these Published Control events:

Code: Select all

[PASS_SEG]         Pwd=[PASSWORD_PROP];           NOT CHECK
[TRUSTED_PROP]     Trusted_Connection=yes;        CHECK
[USERNAME_PROP]    [LogonUser]                    CHECK
- this will tell the SQL connection if it uses Windows Authentication or not
- now you need to disable the Username and Password fields if Windows Authentication is used
- you select the "Password" edit box and in the "Control Conditions" tab you add these control conditions:

Code: Select all

CHECK        Disable
NOT CHECK    Enable
- you also add them for the "Username" edit box
- when the user selects the Windows Authentication checkbox the "Username" and "Password" checkboxes will be disabled (because the user name must be the logon user and the password must be empty)

You can read more about control events here:
http://www.advancedinstaller.com/user-g ... ditor.html

Also, you can read more about the Advanced Installer SQL feature here:
http://www.advancedinstaller.com/user-g ... l-sql.html
http://www.advancedinstaller.com/user-guide/sql.html
http://www.advancedinstaller.com/user-g ... ction.html

Let me know if you encounter any problems.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”