What is the recommended method for executing a SQL Server script from within a .NET application and why?
I'm in process of creating an application we can run from our installer to handle upgrading our database when a prior version of our application is installed. The database has a version table that I can programatically access and determine which upgrade scripts to run to get the database upgraded. It makes sense for me to embed this in an application that our installer can just call to do the upgrade.
I am looking for how best to execute the appropriate upgrade scripts. Searching the web I've seen recommendations for splitting a script by "GO" statements, and using SqlCommand.ExecuteNonQuery(). I've also seen recommendations for using SQL Server Management Objects (SMO).
I'm looking for advice on the pros/cons of the various ways to execute these scripts from within a .NET application.