Complete installation of Inno and Pascal newbie. I want to pack one .sql file inside setup.exe .
The configuration will be available for download, so I cannot embed connection strings in the installation project. The installation basically installs the .NET CLR assembly (dll as a hex stream) into the supplied SQL server database by running a simple .sql script
I saw other messages about connecting to the SQL server, but none of them affects my problem with a tight connection chain or replicates / implements a general data connection dialog that pops up in all MS applications to create a database connection
Ideally, the creation of the connection string should be done through the Data Connection Dialog, which MS issued the code for http://archive.msdn.microsoft.com/Connection , but has no idea how to bind this to pop up during installation.
If this is impossible without (too much) effort, then another option would be to have a custom cut-out version of the dialog box in Inno Setup with only the server name \ path.
Check box
A to indicate whether to use Windows or SQL server authentication (username / password input fields become available when SQL authentication is selected)
At this point, an attempt is made to connect and a dropdown menu with available databases.
I can get the server \ instance text box, but donβt know how to implement Windows authentication \ SQL authentication and next steps
Tips?
edit: Thanks, TLama, the MS-related command line interface does not seem to work. I got the look and feel using the Inno Setup form wizard, but some features still puzzle me:
I have no idea how
enable / disable lblUser , lblPassword , txtUsername , txtPassword when chkSQLAuth.selected true / false.
include the lstDatabase combo lstDatabase and check it if there is content in the txtServer text box.
fill in the lstDatabase combo lstDatabase using the specified credentials (connect to the server and execute "SELECT name FROM master.dbo.sysdatabases WHERE HAS_DBACCESS(name) = 1 ORDER BY name" ) when lstDatabase clicked.
Then enable the "Next" button when the database is selected.
I think that after that I can figure out how to execute my SQL script on the selected database!
[Setup] AppName=test AppVersion=1.0 LicenseFile=C:\Program Files (x86)\Inno Script Studio\License.rtf CreateAppDir=False UsePreviousGroup=False DisableProgramGroupPage=yes Uninstallable=no [Files] Source: "C:\Install Assembly.sql"; DestDir: "{tmp}"; Flags: dontcopy [CustomMessages] CustomForm_Caption=Connect to Database Server CustomForm_Description=Enter the information required to connect to the database server CustomForm_lblServer_Caption0=Server name: CustomForm_lblAuthType_Caption0=Log on credentials CustomForm_lblUser_Caption0=User name: CustomForm_lblPassword_Caption0=Password: CustomForm_lblDatabase_Caption0=Database: CustomForm_chkSQLAuth_Caption0=Use SQL Server Authentication CustomForm_chkWindowsAuth_Caption0=Use Windows Authentication [Code] var lblServer: TLabel; lblAuthType: TLabel; lblUser: TLabel; lblPassword: TLabel; lblDatabase: TLabel; chkSQLAuth: TRadioButton; txtServer: TEdit; chkWindowsAuth: TRadioButton; txtUsername: TEdit; txtPassword: TPasswordEdit; lstDatabase: TComboBox; var Page: TWizardPage; { CustomForm_Activate } procedure CustomForm_Activate(Page: TWizardPage); begin // enter code here... end; { CustomForm_ShouldSkipPage } function CustomForm_ShouldSkipPage(Page: TWizardPage): Boolean; begin Result := False; end; { CustomForm_BackButtonClick } function CustomForm_BackButtonClick(Page: TWizardPage): Boolean; begin Result := True; end; { CustomForm_NextkButtonClick } function CustomForm_NextButtonClick(Page: TWizardPage): Boolean; begin Result := True; end; { CustomForm_CancelButtonClick } procedure CustomForm_CancelButtonClick(Page: TWizardPage; var Cancel, Confirm: Boolean); begin // enter code here... end; { CustomForm_CreatePage } function CustomForm_CreatePage(PreviousPageId: Integer): Integer; begin Page := CreateCustomPage( PreviousPageId, ExpandConstant('{cm:CustomForm_Caption}'), ExpandConstant('{cm:CustomForm_Description}') ); { lblServer } lblServer := TLabel.Create(Page); with lblServer do begin Parent := Page.Surface; Caption := ExpandConstant('{cm:CustomForm_lblServer_Caption0}'); Left := ScaleX(24); Top := ScaleY(8); Width := ScaleX(68); Height := ScaleY(13); end; { txtServer } txtServer := TEdit.Create(Page); with txtServer do begin Parent := Page.Surface; Left := ScaleX(112); Top := ScaleY(8); Width := ScaleX(273); Height := ScaleY(21); TabOrder := 0; end; { lblAuthType } lblAuthType := TLabel.Create(Page); with lblAuthType do begin Parent := Page.Surface; Caption := ExpandConstant('{cm:CustomForm_lblAuthType_Caption0}'); Left := ScaleX(24); Top := ScaleY(48); Width := ScaleX(87); Height := ScaleY(13); end; { chkWindowsAuth } chkWindowsAuth := TRadioButton.Create(Page); with chkWindowsAuth do begin Parent := Page.Surface; Caption := ExpandConstant('{cm:CustomForm_chkWindowsAuth_Caption0}'); Left := ScaleX(32); Top := ScaleY(64); Width := ScaleX(177); Height := ScaleY(17); Checked := True; TabOrder := 1; TabStop := True; end; { chkSQLAuth } chkSQLAuth := TRadioButton.Create(Page); with chkSQLAuth do begin Parent := Page.Surface; Caption := ExpandConstant('{cm:CustomForm_chkSQLAuth_Caption0}'); Left := ScaleX(32); Top := ScaleY(84); Width := ScaleX(185); Height := ScaleY(17); TabOrder := 2; end; { lblUser } lblUser := TLabel.Create(Page); with lblUser do begin Parent := Page.Surface; Caption := ExpandConstant('{cm:CustomForm_lblUser_Caption0}'); Left := ScaleX(56); Top := ScaleY(104); Width := ScaleX(58); Height := ScaleY(13); Enabled := False; end; { lblPassword } lblPassword := TLabel.Create(Page); with lblPassword do begin Parent := Page.Surface; Caption := ExpandConstant('{cm:CustomForm_lblPassword_Caption0}'); Left := ScaleX(56); Top := ScaleY(128); Width := ScaleX(53); Height := ScaleY(13); Enabled := False; end; { txtUsername } txtUsername := TEdit.Create(Page); with txtUsername do begin Parent := Page.Surface; Left := ScaleX(120); Top := ScaleY(104); Width := ScaleX(241); Height := ScaleY(21); Enabled := False; TabOrder := 3; end; { txtPassword } txtPassword := TPasswordEdit.Create(Page); with txtPassword do begin Parent := Page.Surface; Left := ScaleX(120); Top := ScaleY(128); Width := ScaleX(241); Height := ScaleY(21); Enabled := False; TabOrder := 4; end; { lblDatabase } lblDatabase := TLabel.Create(Page); with lblDatabase do begin Parent := Page.Surface; Caption := ExpandConstant('{cm:CustomForm_lblDatabase_Caption0}'); Left := ScaleX(56); Top := ScaleY(168); Width := ScaleX(53); Height := ScaleY(13); end; { lstDatabase } lstDatabase := TComboBox.Create(Page); with lstDatabase do begin Parent := Page.Surface; Left := ScaleX(120); Top := ScaleY(168); Width := ScaleX(145); Height := ScaleY(21); TabOrder := 5; end; with Page do begin OnActivate := @CustomForm_Activate; OnShouldSkipPage := @CustomForm_ShouldSkipPage; OnBackButtonClick := @CustomForm_BackButtonClick; OnNextButtonClick := @CustomForm_NextButtonClick; OnCancelButtonClick := @CustomForm_CancelButtonClick; end; Result := Page.ID; end; procedure CurPageChanged(CurPageID: Integer); begin if CurPageID = Page.ID then WizardForm.NextButton.Enabled := False; end; { CustomForm_InitializeWizard } procedure InitializeWizard(); begin CustomForm_CreatePage(wpWelcome); end;
sql-server connection inno-setup
jkmelbs
source share