Sorry, I don't quite understand your reply earlier.  Compiler doesn't like my 
second SqlDatabase below.  How do I reference a database created in another 
<Component>, without creating it again.

-----Original Message-----
From: Rob Mensching [mailto:r...@robmensching.com] 
Sent: Friday, January 18, 2013 12:24 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Two references to same SqlDatabase

SqlString/@SqlDb. When nested under SqlDatabase that attribute is set to parent 
element.


On Fri, Jan 18, 2013 at 12:05 PM, George Fleming <gef...@microsoft.com>wrote:

> Using Wix 3.7, I want to create a database if the CREATEDATABASE 
> parameter is set on command-line, but then always execute the create 
> login SQL command (which may fail because the login already exists).  
> So my Wix code looks something like this:
>
>     <ComponentGroup Id="SqlComponents" Directory="INSTALLFOLDER">
>       <Component Id='InstallDatabase' Win64="$(var.Win64)" Guid='{Guid}'
> KeyPath='yes'>
>         <Condition>CREATEDATABASE</Condition>
>           <sql:SqlDatabase Id='SqlDatabaseCreate' Database='[SQLDATABASE]'
> User='SQLUser' Server='[SQLSERVER]'
>             CreateOnInstall='yes' DropOnUninstall='no'
> ContinueOnError='no'>
>             <sql:SqlScript Id='AspNetSchema' BinaryKey='AspNetSchema'
> ExecuteOnInstall='yes' Sequence='10'/>
>           </sql:SqlDatabase>
>       </Component>
>
>       <Component Id='SetDatabasePermissions' Win64="$(var.Win64)"
> Guid='{Guid}' KeyPath='yes'>
>         <sql:SqlDatabase Id='SqlDatabaseSet' Database='[SQLDATABASE]'
> User='SQLUser' Server='[SQLSERVER]'
>           CreateOnInstall='no' DropOnUninstall='no' ContinueOnError='no'>
>           <sql:SqlString Id='CreateLogin' ExecuteOnInstall='yes'
> ContinueOnError='yes' SQL='create login [ACCOUNT] from windows'
> Sequence='20' />
>       </Component>
>
>     </ComponentGroup>
>
> Since there is no sql:SqlDatabaseRef statement, I had to created two 
> sqlDatabase statements, under two Components.  The compiler forces me 
> to have two different SqlDatabase Id's, which is fine.  But it won't 
> let me do this because my second SqlDatabase statement has no 'yes' to 
> CreateOnInstall, DropOnInstall, etc.
>
> What is the proper way to do this?
>
>
>
>
> ----------------------------------------------------------------------
> -------- Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API 
> and much more. Get web development skills now with LearnDevNow -
> 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
> SALE $99.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122812
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and much more. Get 
web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users




------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to