I am sorry...following is the relavant code snippet.  I hope this helps. :)

(declaring properties...)




(defining custom action...)


SOLUTIONEXISTS = exists      

(sequencing custom action...)

   NOT Installed
   NOT Installed
   NOT INSTALLED 
   NOT Installed           
   CONFIGFILEPATH
   CONFIGFILEPATH     


C# Custom action:

public static ActionResult GetSolutionDatabase(Session session)
        {        
            CustomActionData customActionData = new
CustomActionData(session["INSTANCENAME"]);
            string serverName = @"Localhost\" +
session["INSTANCENAME"].ToString();
            string connStr = @"Data Source=" + serverName + ";Initial
Catalog=MASTER;Integrated Security=SSPI;";
            string sqlStr = "Select count(*) as DBCount from sys.databases
where name = "MyAppDB";

            SqlConnection sqlConn = new SqlConnection(connStr);
            SqlCommand cmd = new SqlCommand(sqlStr, sqlConn);
            SqlDataReader reader;

            try
            {
                sqlConn.Open();
                reader = cmd.ExecuteReader();
                while (reader.Read())
                {                    
                    if (reader["DBCount"].ToString() == "1")
                    {
                        session["SOLUTIONEXISTS"] = "exists";                   
     
                    }
                    else
                    {
                        session["SOLUTIONEXISTS"] = "notexists";
                    }
                }
                return ActionResult.Success;
            }
            catch (Exception ex)
            {
                return ActionResult.Failure;
            }
        }

--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Check-Property-value-in-Condition-element-tp6223537p6224618.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to