如何使用C#运行存储在.sql文件中的SQL查询 [英] How to run sql query stored in .sql file using C#

查看:53
本文介绍了如何使用C#运行存储在.sql文件中的SQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文件Script.sql
包含

i have a file Script.sql
that contains

USE MyDataBase
GO
BACKUP DATABASE MyDataBase
TO DISK = ''C:\MyDataBase.Bak'';
   WITH FORMAT,
      MEDIANAME = ''MyDataBase_Backup'',
      NAME = ''Full Backup of MyDataBase'';
GO



如何使用C#读取此文件并将其作为sql查询运行?

感谢



how to read this file using C# and run it as sql query?

thanks

推荐答案

当您在此处提出相同的问题时,谷歌会抛出什么惊奇.
http://social.msdn.microsoft.com/论坛/en-NZ/adodotnetdataproviders/thread/43e8bc3a-1132-453b-b950-09427e970f31 [
Amazing what google throws up when you ask the same question there.
http://social.msdn.microsoft.com/Forums/en-NZ/adodotnetdataproviders/thread/43e8bc3a-1132-453b-b950-09427e970f31[^]


这篇关于如何使用C#运行存储在.sql文件中的SQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆