How can I execute a .sql from C#?

前端 未结 6 607
旧时难觅i
旧时难觅i 2020-12-04 20:05

For some integration tests I want to connect to the database and run a .sql file that has the schema needed for the tests to actually run, including GO statements. How can I

6条回答
  •  一向
    一向 (楼主)
    2020-12-04 21:01

    If you add following references in your project, then original code will work fine.

    I use SQL 2008 Express.

    Path: C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\

    Files: microsoft.sqlserver.smo.dll, microsoft.sqlserver.connectioninfo.dll and Microsoft.SqlServer.Management.Sdk.Sfc.dll

提交回复
热议问题