Run SQL Script with .net executable

I have a C # .net application that has been distributed separately for several clients. From time to time, we add some new features or fix some errors and often make changes to the database. I use a one time deployment approach to upgrade exe for my client. An instance of SQL Server was installed on their system.

I want to know how I can update my sql database with every exe update.

Please remember that it is possible that the client is working on version 2 and will never upgrade to version 3, but when version 4 is released, it updates the application. In this case, I need to execute two scripts in my database. One for version 3 and one for the current version, which is 4.

thank

+5
source share
4 answers

Assuming you have a / script stored procedure that can update one version to another, and if you cannot load any other exe that will launch it, why don't you just include the call to start it at the beginning of the new version ? Is there a check when the software that is looking for is downloaded, if they are using the correct version of the database, if not, update it. To deal with issues such as upgrading from version 2 to 4, just make sure the database itself keeps track of which version is currently running.

+2
source

You can try sqlcmd and just call exe from your application using database updates.

0
source
0

:

1.

WinForms, SQL- , SQL, scruipt. script SQL "Manifest.xml", script.

script .

script . , . 7-zip- .

2.

, ( ) . , .

, appversion > dbversion .

In installations where there is only one step and production setup for one individual client and usually not an application, I will use the stand-alone CLI application manually. This is an easy way to update, especially if you have changed 20 views and REALLY don't feel like copying / pasting them all in Mgt Studio SQL: p

0
source

All Articles