How to execute sql script file in Sql Server 2008
I want to execute a sql script file if user want to apply the new database changes. That script file is present on the server and if user wants to apply the new changes it just press a button i want to know how to execute that script file to a particul开发者_JAVA百科ar server database in Sql Server 2008. I want to do this in C# code file
Google c# SqlConnection, SqlCommand
Look at the example provided here
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.aspx
Note: if the sql is in a file you will have to read the content of the file into a string first!
Use SQLCMD ?
Updated:
Look at here - it may help you.
精彩评论