TAGS :Viewed: 6 - Published at: a few seconds ago

[ How to make Update Package Of SQL Scripts in C# ]

I'm trying to make an update package (.exe or .cab or ...) I want my client to be able to use it in a simple way to execute my scripts on their DB I know how to run scripts in C# but I want a way to somehow integrate my scripts so that the client can receive them in any executable format you suggest best regards sorry for bad English

Answer 1

You can simply add them to your C# project and include them in your installation package. These will be saved as files in the program directory or a subordinate folder (not necessarily a good idea) which you can then open by reading them in as text and submitting as commands. Rather than running the SQL commands directly, it would probably be better to 'create procedure xyz' and then run the sprocs from the sqlcommand object in C#. If someone finds the sql and runs it all they'll do is recreate the stored procedure, not rerun whatever commands you streamed into the database.