Executing SQL scripts from C#
Is there any programmatic way to execute a sql script from C#? I'm using SQL Server and I do not want to use osql.exe. Here is an example:
CREATE TABLE...
GO
CREATE TABLE...
GO
CREATE CONSTRAINT...
GO
INSERT DATA...
GO
I tried reading the file and setting the CommandText in the SqlCommand object, but since the GO needs to be in a separate line when executing, SQL Server gives an error. I tried some various newline characters, but none worked. Any thoughts?
Thanks,
Evan