Hi

I'd guess your problem is in the script

BEGIN 
     ALTER DATABASE [SOLUTIONDATABASENAME] 
     SET SINGLE_USER WITH ROLLBACK IMMEDIATE; 
     USE MASTER; 
     DROP DATABASE [SOLUTIONDATABASENAME]; 
     END"

Does this work in sql management studio - I would guess you need some go 
statements - especially after the Use Master.

Better option to do this would be create a SqlDatabase entry for Master that is 
located under the Product (so it is not associated with a component).

Then run you alter and drop database scripts as two separate scripts associated 
with the Master SqlDatabase entry (these can be under the component).   Don't 
put the USE statement in at all.

Michael

-----Original Message-----
From: kim [mailto:contactme...@gmail.com] 
Sent: Saturday, 12 February 2011 8:04 AM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] Drop database on Uninstall not working


I want to drop the database installed by my msi on uninstall. It does drops
the Db on roll-back but not on uninstall. Following is the code from my
config file. Since setting DropOnUninstall=yes did not worked, so I added
other sql string to execute Drop database command.  I am not receiving any
error on uninstall and verbose log has no errors. It appears to me that the
script is not executed? 

can someone suggest whats going wrong here? Thanks! 

 <Component Id="CreateSolutionDB" DiskId="1"
Guid="{A4957B82-2F6D-44B7-8AD2-44124F69239C}" KeyPath="yes"> 
   <sql:SqlDatabase Id="dbSolution" Server="[SQLSERVERNAME]\[INSTANCENAME]"
Database="[SOLUTIONDATABASENAME]" 
CreateOnInstall="yes" ConfirmOverwrite="yes" DropOnReinstall="no"
DropOnUninstall="no"> 
                  
 <sql:SqlScript Id="CreateTablesSqlScriptWindows" ContinueOnError="yes"
ExecuteOnInstall="yes" ExecuteOnReinstall="no" Sequence="1"
BinaryKey="CreateSolutionDBBin" /> 
                  
<sql:SqlString Id="AddWebcoreLogin" ContinueOnError="no"
ExecuteOnInstall="yes" Sequence="2" 
SQL="IF NOT EXISTS(SELECT name FROM sys.server_principals WHERE name =
'[SOLUTIONUSERNAME]') 
BEGIN 
   CREATE LOGIN [SOLUTIONUSERNAME] WITH PASSWORD='[SOLUTIONUSERPASSWORD]'; 
   CREATE USER [SOLUTIONUSERNAME] FOR LOGIN [SOLUTIONUSERNAME]; 
END;"/> 

<sql:SqlString Id="AddRoleToWebcoreUser" ContinueOnError="no"
ExecuteOnInstall="yes" Sequence="3" SQL="EXEC sp_addrolemember
'db_owner','[SOLUTIONUSERNAME]'"/> 

<sql:SqlString Id="DropSolutionDB" ContinueOnError="no"
ExecuteOnUninstall="yes" Sequence="2" 
SQL="IF EXISTS (SELECT name FROM sys.databases WHERE name =
'[SOLUTIONDATABASENAME]') 
BEGIN 
     ALTER DATABASE [SOLUTIONDATABASENAME] 
     SET SINGLE_USER WITH ROLLBACK IMMEDIATE; 
     USE MASTER; 
     DROP DATABASE [SOLUTIONDATABASENAME]; 
     END" 
     /> 

<sql:SqlString Id="DropWebcoreLogin" ContinueOnError="no"
ExecuteOnUninstall="yes"  Sequence="3" 
SQL="IF EXISTS(SELECT name FROM sys.server_principals WHERE name =
'[SOLUTIONUSERNAME]') 
   BEGIN 
       DROP LOGIN [SOLUTIONUSERNAME]; 
    END"/> 
</sql:SqlDatabase> 
</Component>  


-- 
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Drop-database-on-Uninstall-not-working-tp6017327p6017327.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to