See a first sample I googled (bottom of the thread) here
http://social.msdn.microsoft.com/Forums/en/adodotnetdataproviders/thread/43e8bc3a-1132-453b-b950-09427e970f31You need to google on 'SMO run SQL Script .NET'
Another link
http://mkdot.net/blogs/boban/archive/2008/08/07/run-a-sql-script-files-in-c.aspx(I hate the black background of the blog)
I posted a solution a while ago here in response to Michel Fournier, but I don't remember in which forum and quick search didn't find it.
>Charles, yes you do understand correctly.
>I can generate the scripts OK and get them to the laptop.
>I'm with you so far.
>My problem is how to run the script once I get it there.
>I can conceive of a C# program that turns the script into a string and uses that as the the text of an ADO.NET command.
>In theory, that will probably work, but it sounds kludgy.
>
>
>
>
>
>>>If I understand correctly, why not just generate change scripts for whatever is different on the server and put them in a folder. When the laptops come in and hookup, the go to that folder and run the change scripts. Give each script a guid as a name and let the laptops maintain a list of guids for scripts they have run, only running those that haven't been run before. Probably need to figure out sequencing but that shouldn't be too difficult, especially if you assign the guids as newsequentialguids ( or just some other id system )
>
>Redgate tools could probably make the script generation pretty easy.
If it's not broken, fix it until it is.
My Blog