如何在.net桌面应用程序中存储和访问数据库? [英] How to store and access the database in .net desktop application?

查看:410
本文介绍了如何在.net桌面应用程序中存储和访问数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我做了一个应用程序(用过:C#win form,sql server 2008 r2)。



现在,当我进行营销并希望将演示版本提供给客户端时,我也必须安装sql server。



每次安装Sql服务器对我来说都很头疼,需要花费很多时间。



任何人都可以提供任何解决方案我该如何存储我的应用程序中只有数据库?



谢谢大家。

Hello,

I made an application(used : C# win form, sql server 2008 r2).

Now when I goes for the marketing and want to give the demo version to client I have to install the sql server also.

Everytime installing the Sql sever is an headach to me, it take lots of time.

Can any one give any solution how can I store database in my application only?

Thank you to all.

推荐答案

如果你使用的是单个用户,然后SQL服务器是一个非常糟糕的主意。

考虑将代码更改为使用SQLite或SqlCE(甚至是Access),除非您确实需要多用户访问。



如果您需要多个用户,那么它就是SQL服务器 - 这意味着您的应用程序需要网络上的SQL服务器实例并且在运行时可以访问 - 没有办法围绕它,所以如果它不存在,你将不得不安装它。您可以更改为MySql,但这也需要服务器安装,因此不会以任何方式更改您的问题。
If you are using this for a single user, then SQL server is a very poor idea.
Consider changing your code to use SQLite, or SqlCE (or even Access) instead, unless you really need multi-user access.

If you need multiple users, then SQL server it is - and that means that your application needs an instance of SQL server on the network and accessible when it runs - there is no way round that, so if it isn't there, you will have to install it. You could change to MySql, but that needs a server installation as well, so it wouldn't change your problem in any way.


为什么要多次重新安装服务器?



请仅使用1台服务器。在客户端的PC上,只更改连接字符串,这样您就可以通过Internet连接到服务器。
Why should you re-install server many times ???

Please use only 1 server. And on Client's PC, change "connection string" only, so you can connect to your server through the Internet.


简单安装数据库(sql server)时确保它也可用于网络。

和你的应用程序连接字符串将数据源作为机器ip提供,并提供连接数据库的凭据。并在任何你想要的地方运行你的应用程序。
simple while installing database(sql server) make sure it's available for network also .
and in ur application connection string give the data source as the machine ip and give credentials for connecting to database .And run ur application wherever u want .


这篇关于如何在.net桌面应用程序中存储和访问数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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