Difficulty With Batch Processing Of Scripts

I'm working on creating a new system to replace the current system we are using. The means writing a program to load all the data in the old system, convert it to the new system, and initialize the new system.

The program currently does this.
Drop triggers
Drop tables
Create tables
Load old data
Convert data
Save data to new database

After that I load up several script files in Query Analyzer and run them to create the triggers.

I would like to get my program to execute the scripts automatically to avoid the last manual step.

This is the code I have to do that.
If Directory.Exists("Scripts") = False Then
Return
End If

Dim files As String() = Directory.GetFiles("Scripts")

For i As Integer = 0 To files.Length - 1
Dim ext As String = files(i).Split(CChar("."))(files(i).Split(CChar(".")).Length - 1)
If ext.ToUpper() <> "SQL" Then
Continue For
End If

Dim script As String = File.ReadAllText(files(i))
Dim result As Integer = New SqlCommand(script, myconnection).ExecuteNonQuery()
If result = 0 Then
Return
End If
Next

Obviously, simple and straight forward. However, whoever is processing the scripts doesn't like them. I'm getting a lot of errors. Here's the first few lines of a script.
USE MyDB

GO

IF OBJECT_ID (N'dbo.Contract_Updated') IS NOT NULL BEGIN
DROP TRIGGER dbo.Contract_Updated
END

GO

First it doesn't like the USE statement. Not a problem. I can comment that out. However, if doesn't like the DROP TRIGGER statement.

Does anyone know how to get the DROP TRIGGER to work. Also, does anyone know of a reference that I can use to modify my scripts to work when executed by my program.

Maybe the problem is how I'm loading the files. Do I need to convert end of line charactors to something else? Or maybe some other issue?

Thanks,
Scott MacMaster
[2219 byte] By [Scott MacMaster] at [2007-11-20 11:25:40]
# 1 Re: Difficulty With Batch Processing Of Scripts
You've not said what DB you are using. Assuming it's SQLServer 2005, You should use SSIS, this will simplify the whole process.
Bill Crawley at 2007-11-10 3:08:22 >