使用C#自动进行SQL脚本编写 [英] Automated SQL scritpting with C#

查看:115
本文介绍了使用C#自动进行SQL脚本编写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.

从SQL Management Studio中,我可以将表(以及其他SQL对象)的CREATE脚本保存到文件中.
我想知道是否存在从C#中执行相同操作的方法.

我在交付应用程序并创建所有空表时,正在使用通用WinForm Install/Config应用程序(类似向导)进行首次使用.通常的想法是将这些脚本放在目录中,以便此Config应用程序读取并执行所有脚本.

顺序:设置(VS生成)->配置APP(*)->运行应用程序.

(*)向用户询问SQL Server的位置,建立连接,编写配置文件等.

在此先谢谢您.

解决方案

文章 [ ^ ]可能会为您提供帮助.

太好了!谢谢拉维.

问候来自乌拉圭.


Hi folks.

From SQL Management Studio I''m able to save to a file the CREATE scripts of the tables (and other SQL objects too).

I''m wondering if exists a way to do the same from within C#.

I''m working in a generic WinForm Install/Config application (wizard like) for first time use when I deliver an application, and creating all empty tables. The general idea is to have those scripts in a directory, for this Config app read and execute all of them.

Sequence: Setup (VS Generated) -> CONFIG APP (*) -> Run app.

(*) Asking to the user where the SQL Server is, teting connections, writing config files, etc.

Thanks in advance.

解决方案

This article[^] might help you.


Great! Thank you Ravi.

Regards from Uruguay.


这篇关于使用C#自动进行SQL脚本编写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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