Issue with MS SQL Script - Advanced Installer Community
nikhulion
Posts: 7
Joined: Sun Jun 01, 2014 8:28 am

Issue with MS SQL Script

I am trying to make a installer for my web application which is developed in .net. Now i stuck in installing the database. The installation will be happen in client premises so we don't know the IP of the local server or sa login and after the installation in need this information to be added in my web application web.config file, is it possible?. How can i make this work using your installer.
nikhulion
Posts: 7
Joined: Sun Jun 01, 2014 8:28 am

Re: Issue with MS SQL Script

I made the database using the SQL Script through the instlaller. Now my question is how i will make the connection string in IIS with the information i got from client while the installation step. I also need to add in IIS connection string and as well in web.config of the application.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Issue with MS SQL Script

Hello and welcome to Advanced Installer forums,

Thank you for your interest in Advanced Installer.

In order to achieve what you want you should use the properties (e.g. SERVER_PROP, USERNAME_PROP, PASSWORD_PROP) associated with the edit boxes controls from "SQLConnectionDlg" dialog to update your app config XML files. Also, you should import in "Files and Folders" page your app config XML files in Windows Installer format. Please take a look on our "How do I import and edit a XML file?" article which should be useful for you.

If you have any question let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
nikhulion
Posts: 7
Joined: Sun Jun 01, 2014 8:28 am

Re: Issue with MS SQL Script

Hi Daniel,

Thank you for your support.

Actually i sort it out yesterday itself. Now i have one question can we create a new dbo user from the installer and assign that user (owner of database) to the database which i am creating from the installer (i am using the Sql script to creating the Database)?

Regards
Nikhil
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Issue with MS SQL Script

Hello Nikhil,

You're welcome. I'm glad you sorted this out.

Unfortunately, we don't have predefined support to create an SQL user. However, in order to achieve this you can write your own SQL script with this functionality and add it in "SQL Scripts" page. Please take a look on "SQL Server Script to create a new user" thread which should be useful for you.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
nikhulion
Posts: 7
Joined: Sun Jun 01, 2014 8:28 am

Re: Issue with MS SQL Script

Hi Daniel,

That one also i sort it out, now i can create database user from your installer itself, it is bit tricky walk around on your application. But i made it working.

Now i have another query, i made a form where user can type the Database Username, Password and confirm password. I want to validate this field this fields should be mandatory. After filling this form completely then only user can navigate to the next step and i need to compare the password type in the textbox.

How i can make this done.

Regards
Nikhil
---------------------------------------------------------
My walk around for creating Database user

In SQL Script i made it like this

Code: Select all

CREATE LOGIN _username_
WITH PASSWORD = '_password_';
GO

-- Creates a database user for the login created above.
CREATE USER _username_ FOR LOGIN _username_;
GO
exec sp_addrolemember 'db_owner', '_username_'
go
And from the Script replacement tab i replaced this field (_username_ and _password_) with the property i created which is assigned to the textbox in the Form.

--------------------------------------------------
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Issue with MS SQL Script

Hello Nikhil,
Now i have another query, i made a form where user can type the Database Username, Password and confirm password. I want to validate this field this fields should be mandatory. After filling this form completely then only user can navigate to the next step and i need to compare the password type in the textbox.
In order to achieve this you can use our "Dialog Editor" feature. Here are the main steps to proceed:
- go to "Dialogs" page and create a new dialog containing four edit boxes (e.g. MY_DATABASE_PROP, MY_USERNAME_PROP, MY_PASSOWRD_PROP and RE_PASSWORD_PROP)
- on the [Next] button add a published event like this:
  • Control Event: Display a specific child dialog
    Argument: <NewDialog>
    Condition: ((MY_DATABASE_PROP = "") OR (MY_USERNAME_PROP = "") OR (MY_PASSOWRD_PROP = "") OR (RE_PASSWORD_PROP = "") OR (MY_PASSOWRD_PROP <> RE_PASSWORD_PROP))
- please make sure that the above control event is added as the last event in the published events list (use the [Down] button to move it)
- edit the added spawn dialog in tree (under your validation dialog) to display a meaningful message
- build and run your project

Also, I've attached a sample created with version 11.2.1 of Advanced Installer which implements a similar scenario.
sample.zip
(3.15 KiB) Downloaded 198 times
If you have any question let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
nikhulion
Posts: 7
Joined: Sun Jun 01, 2014 8:28 am

Re: Issue with MS SQL Script

Hi Daniel,

Thank you for your support, it worked for me.

Now i want to know how i can give a permission (read,write) to a folder.

I give through the File and Folder page, but it is not working for me. I am installing the app in server, is there any other thing is need to care about.

Regards
Nikhil
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Issue with MS SQL Script

Hello Nikhil,

You're welcome.

Please keep in mind that when using our "Folder Permissions" tab to add permissions on a certain folder, the related permissions will be created from scratch. They will not be added to the default ones. This is the default Windows Installer support. So, when using our "Permissions" tab you should explicitly set all required permissions for a folder.

In order to add specific permissions to the default ones you can use a custom action like it is debated in our "Filesystem permissions do not flow to sub folders" thread.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
nikhulion
Posts: 7
Joined: Sun Jun 01, 2014 8:28 am

Re: Issue with MS SQL Script

Hi Daniel,

I tried to do follow those step but i couldn't make it.

I am attaching a screen shot of my setup in "Custom Action", please have a look and let me know where i went wrong.

Regards
Nikhil
Attachments
citasmart-intaller.jpg
citasmart-intaller.jpg (241.65 KiB) Viewed 7120 times
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Issue with MS SQL Script

Hello Nikhil,

In order to achieve what you want you should schedule your "Launch EXE with working directory" as deferred with no impersonation like this:
  • File Path: cacls
    Command Line: MediaFiles /t /e /c /p Users:f
    Working Directory: APPDIR
, where "MediaFiles" is a sub-folder of the "Application Folder" directory from "Files and Folders" page.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
nikhulion
Posts: 7
Joined: Sun Jun 01, 2014 8:28 am

Re: Issue with MS SQL Script

Hi Daniel,

Still i couldn't achieve that permission to that folder, now i am manually giving permission (Everyone - Full Control) to the main directory. I also given permission from the Folder option as Administration.

So what will be another option or way too achieve the permission.

Please find the attached screen shot.

Regards
Nikhiil
Attachments
Custom Actions
Custom Actions
screenshot2.jpg (183.71 KiB) Viewed 7028 times
Files and Folders Page
Files and Folders Page
screenshot1.jpg (235.25 KiB) Viewed 7028 times
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Issue with MS SQL Script

Hello Nikhiil,

Can you please proceed like this:
1. remove the added permissions entry on the "MediaFiles" permissions tab from "Files and Folders" page
2. go to "Custom Actions" page, add your custom action as a custom action with sequence scheduled after "Install Execution Stage -> Add Resources" actions group
3. make sure your custom action execution time is set to "Deferred" and the "Run under the LocalSystem account with full privileges (no impersonation)" execution option is enabled

and see if this helps, otherwise please send us the .aip (project file) to support at advancedinstaller dot com so we can investigate it. Also, please specify what permissions you are trying to configure for your "MediaFiles" folder.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”