SqlException: Syntax Error Near 'GO'

前端 未结 3 921
無奈伤痛
無奈伤痛 2021-01-17 11:06

I am having trouble sending a SQL statement through a DbContext using context.Database.ExecuteSqlCommand().

I am trying to execute

CREA         


        
3条回答
  •  Happy的楠姐
    2021-01-17 11:45

    Dave Markle beat me to it. In fact, you can change "GO" to any other string to separate batches.

    An alternative implementation here is to use SMO instead of the Entity Framework. There is a useful method there called ExecuteNonQuery that I think will make your life a lot simpler. Here is a good implementation example.

提交回复
热议问题