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 particular server database in Sql Server 2008. I want to do this in C# code file

Answers


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!


Need Your Help

Why is this F# code so slow?

c# performance f#

A Levenshtein implementation in C# and F#. The C# version is 10 times faster for two strings of about 1500 chars. C#: 69 ms, F# 867 ms. Why? As far as I can tell, they do the exact same thing? Does...

R: How to measure similarity between strings?

regex string r r-faq

I have a bunch of names, and I want to obtain the unique names. However, due to spelling errors and inconsistencies in the data the names might be written down wrong. I am looking for a way to chec...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.