GO statements blowing up sql execution in .NET

前端 未结 11 1048
南笙
南笙 2020-12-05 09:48

I have a very simple C# command shell app that executes a sql script generated by SQL Server for scripting schema and data. It\'s blowing up on the \"GO\" statements. Error

11条回答
  •  甜味超标
    2020-12-05 10:14

    Just replace "GO" with "" and it works.

    SqlCommand command = new SqlCommand(script.Replace("GO", ""), connection);
    command.CommandType = CommandType.Text;
    command.ExecuteNonQuery();
    

提交回复
热议问题