Turns out the sourceforge wix2 documentation regarding the SqlDatabase
element is still valid for wix3's version of SqlDatabase.

http://wix.sourceforge.net/manual-wix2/wix_xsd_sqldatabase.htm

Wow, if we could just have one place for all the documentation, it
would really help a lot with the confusion and frustration of trying
to learn wix.

Tim

On Thu, Jun 12, 2008 at 6:18 PM, Tim Fisher <[EMAIL PROTECTED]> wrote:
> I created a new wxs file with a Fragment in it, then I moved my SqlDatabase
> element over into the Fragment element like this:
>
> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";
> xmlns:sql="http://schemas.microsoft.com/wix/SqlExtension";>
>        <Fragment>
>                <sql:SqlDatabase Id="DB1" Server="[DBSERVERNAME]"
> Database="master">
>                        <sql:SqlString Id="RollbackDb"
> RollbackOnInstall="yes" SQL="DROP DATABASE [\[][DBNAME][\]]" Sequence="1" />
>                        <sql:SqlString Id="InstallDb" ExecuteOnInstall="yes"
> SQL="CREATE DATABASE [\[][DBNAME][\]] ON (FILENAME=N'[#MDF]') FOR ATTACH"
> Sequence="2" />
>                        <sql:SqlString Id="CreateUserId" SQL="IF NOT EXISTS
> ( SELECT * FROM sys.server_principals WHERE name = N'[USERIDVALUE]' ) CREATE
> LOGIN [USERIDVALUE] WITH PASSWORD='[PWDVALUE]', DEFAULT_DATABASE=[DBNAME],
> CHECK_POLICY=OFF;USE [DBNAME];IF EXISTS(SELECT name FROM sys.sysusers WHERE
> name=N'[USERIDVALUE]')DROP USER [USERIDVALUE];CREATE USER [USERIDVALUE];EXEC
> sp_addrolemember db_owner, [USERIDVALUE];" ExecuteOnInstall="yes"
> Sequence="3" />
>                </sql:SqlDatabase>
>        </Fragment>
> </Wix>
>
> Now I have two new questions.
>
> First, how do I reference this SqlDatabase element over in the Component
> element that uses it over in the main wxs file?
>
> Second, when I try to compile I get, "SqlString element cannot be specified
> unless the element has a component as an ancestor." How did you get your
> SqlStrings to work using a Fragment?
>
> Tim
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Rob Mensching
> Sent: Friday, June 06, 2008 12:46 PM
> To: General discussion for Windows Installer XML toolset.
> Subject: Re: [WiX-users] Attach a database
>
> If you place the SqlDatabase element under a Component element that will
> attempt to create the database.  My SqlDatabase element is a direct child of
> one of my Fragment elements.  It is a little confusing but that causes the
> SqlDatabase element to search for an existing database.  Unfortunate naming
> a long time ago that hasn't been straightened out.
>
>
>

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to