如何从SQLSERVER对.NET应用程序运行SQL和获取输出像SQL Management Studio中? [英] How to run sql from a .net application against sqlserver and get output like with SQL Management Studio?

查看:120
本文介绍了如何从SQLSERVER对.NET应用程序运行SQL和获取输出像SQL Management Studio中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的应用程序来运行SQL文件,并收到了效果输出,如果SQL从SQL Management Studio中运行带有结果的文本。即很好地格式化记录集,打印的消息,受影响的行,错误,运行由GO语句分隔的多个批次等任何建议如何做到这一点不用从头在一个正常的SQL连接上建立的呢?

I'd like my app to run sql files and receive the results output as if the sql was run from SQL Management Studio with results to text. i.e. nicely formatted recordsets, printed messages, rows affected, errors, running multiple batches separated by GO statements, etc. Any suggestions how to do this without building it from scratch on top of a normal SQL connection?

我使用C#.NET

推荐答案

你不说什么语言的应用程序是用,但如果你使用.NET,则可能会从源头$ C $一些帮助下 QueryExPlus ,一个轻量级的开源替代SSMS。

You don't say what language your application is written in, but if you're using .Net, you might get some help from the source code for QueryExPlus, a lightweight OSS alternative to SSMS.

这篇关于如何从SQLSERVER对.NET应用程序运行SQL和获取输出像SQL Management Studio中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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