Windows窗体应用程序设置与数据库

时间:2023-01-13 00:02:00

I've written an app that needs a database. I've been using a local copy of SQL Server on my machine but would like to build a setup for this application that installed it's own database to support the application. I'd rather not have to have the user install SQL on their own and then configure the application.

我写了一个需要数据库的应用程序。我一直在我的机器上使用SQL服务器的本地副本,但是我想为这个应用程序构建一个安装它自己的数据库来支持这个应用程序的设置。我不希望用户自己安装SQL,然后配置应用程序。

Can anyone point me in the right direction here?

谁能给我指出正确的方向吗?

2 个解决方案

#1


1  

Create a Setup and Deployment > Setup project in Visual Studio - you can add pre-requisites like enforcing .net framework version, install SQL express and generally configure files/folders/shortcuts.

在Visual Studio中创建一个安装和部署>安装项目——您可以添加一些先决条件,比如执行。net框架版本、安装SQL express和配置文件/文件夹/快捷方式。

You can use the attach db file method of the connnection string to actually attach the mdf to the sql server - or - you can write your own sql scripts to run if you need more complex set-ups.

您可以使用connnection字符串的attach db文件方法将mdf实际附加到sql服务器——或者——如果需要更复杂的设置,您可以编写自己的sql脚本来运行。

#2


2  

Here is a good article on embedding SQL Server Express in your application and then deploying it.

这里有一篇关于在应用程序中嵌入SQL Server Express并部署它的好文章。

#1


1  

Create a Setup and Deployment > Setup project in Visual Studio - you can add pre-requisites like enforcing .net framework version, install SQL express and generally configure files/folders/shortcuts.

在Visual Studio中创建一个安装和部署>安装项目——您可以添加一些先决条件,比如执行。net框架版本、安装SQL express和配置文件/文件夹/快捷方式。

You can use the attach db file method of the connnection string to actually attach the mdf to the sql server - or - you can write your own sql scripts to run if you need more complex set-ups.

您可以使用connnection字符串的attach db文件方法将mdf实际附加到sql服务器——或者——如果需要更复杂的设置,您可以编写自己的sql脚本来运行。

#2


2  

Here is a good article on embedding SQL Server Express in your application and then deploying it.

这里有一篇关于在应用程序中嵌入SQL Server Express并部署它的好文章。