设置C#.net WinForms应用程序的创建 [英] Set up Creation of C#.net WinForms Application

查看:91
本文介绍了设置C#.net WinForms应用程序的创建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试以执行数据库脚本文件的方式创建项目的安装程序,以便以后不再创建数据库.

解决方案

<只需让应用程序本身负责创建数据库.它可以在启动之前先检查它是否存在.


您可以创建一个安装脚本.
只需使用安装程序脚本创建一个类库.从该安装程序脚本中检查数据库是否存在.您可以使用普通的SqlClient类,也可以根据需要将SMO包含在安装程序中.

现在,如果数据库不存在,请运行数据库创建逻辑,并将连接字符串放在安全的位置.

在您的应用程序中,请始终使用此连接字符串.

我已经使用此工具构建了一个安装程序,并在其中使用SMO创建了数据库.效果很好.

:)


I am trying to Create Setup of the Project in such a way that the Database Script file will be Executed so that I will not create a database later on.

解决方案

Just have the application itself be responsible for creating the database. It can check to see if it exists before trying to create it when it starts up.


You can create an Installer Script.
Just create a class library with the installer script. From that installer script check if the database exists. You can use normal SqlClient classes or you might also include SMO to the installer if you wish.

Now if the database doesnt exists, run the database creation logic, and place the connectionstring somewhere secure.

From your application use this connectionstring always.

I have already built one installer using this, where I have used SMO to create database. It is working great.

:)


这篇关于设置C#.net WinForms应用程序的创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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