I would like to use the Database.ExecuteNonQuery or something similar to execute a sql script and then capture the output.
eg: xxx Table created
My script:
strArray = Regex.Split(streamReader.ReadToEnd(), "\r\nGO");
if (connection.State == ConnectionState.Open)
{
System.Data.SqlClient.SqlCommand cmd;
foreach (string sql in strArray)
{
cmd = new System.Data.SqlClient.SqlCommand(sql);
cmd.Connection = connection;
Console.WriteLine(sql);
Console.WriteLine(cmd.ExecuteNonQuery().ToString());
}
}