You need to escape them.  Replace '[' with '[\[]' and ']' with '[\]]'.

--
John Merryweather Cooper
Senior Software Engineer | Enterprise Service Applications | Continuing 
Development
Jack Henry & Associates, Inc.® | Lenexa, KS  66214 | Ext:  431050 
|jocoo...@jackhenry.com



-----Original Message-----
From: patrickpirzer [mailto:patrick.pir...@prosoft.net] 
Sent: Monday, December 15, 2014 8:53 AM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] How can i use variables in SqlString?

I want to create a new SQL Login, so i tried this with the following
SqlString:

        <Component Id="CreateUserAccount"
                   Guid="AEE91491-99FA-40A9-AB47-1E9FC2DDEF2A"
                   Directory="INSTALLDIR">
            <sql:SqlString Id="SqlLogin"
                           SQL="IF NOT EXISTS (SELECT * FROM sysusers WHERE
name='[MyUser]')
                           BEGIN
                           EXEC sp_grantdbaccess '[MyUser]'
                           END"
                           ExecuteOnInstall="yes"
                           SqlDb="[MyDatabase]"/>
        </Component>

Unfortunately the brackets around the variables like MyUser and MyDatabase are 
not accepted by the compiler.
How can i use variables in the SqlString-element?

Thanks in advance!
Patrick




--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/How-can-i-use-variables-in-SqlString-tp7598582.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! 
Instantly Supercharge Your Business Reports and Dashboards with Interactivity, 
Sharing, Native Excel Exports, App Integration & more Get technology previously 
reserved for billion-dollar corporations, FREE 
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
NOTICE: This electronic mail message and any files transmitted with it are 
intended
exclusively for the individual or entity to which it is addressed. The message, 
together with any attachment, may contain confidential and/or privileged 
information.
Any unauthorized review, use, printing, saving, copying, disclosure or 
distribution 
is strictly prohibited. If you have received this message in error, please 
immediately advise the sender by reply email and delete all copies.


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to