如何在c#.net中使用数据库创建Windows表单应用程序? [英] How do I create a windows form application in c#.net with the database?

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

问题描述

你好,

我想创建一个Windows应用程序C#,其中包含一个数据库。因为当我安装我的Windows窗体时,我想用exe文件自动安装数据库。

请给我一个解决方案..我将在哪里创建数据库,我该如何部署?



我尝试了什么:



i试图用SQL server management studio制作数据库。但是当我安装时我也必须安装该服务器。支持脚本

hello,,
I want to create a windows application C# and which includes a database . because when i install my windows form i want to install database automatically with the exe file.
please give me a solution for .. where would i create database and how can i deploy that?

What I have tried:

i tried making database with SQL server management studio. but when i am installing i have to install that server too . to support script

推荐答案

这将取决于你想对数据库做什么:如果你想让它被多个人同时使用(一个多用户数据库)然后您将需要SQL Server或MySQL。如果您只需要一个人访问的数据库而不与其他人共享数据(单用户数据库),那么您可以使用更简单的系统。



SQL Server和MySQL是一个庞大而复杂的软件包 - 因为他们在幕后做了很多工作,以使您的数据与多个用户一起工作。因此,它们是大型,复杂的应用程序,在安装时需要小心和注意,并且安装起来并不容易 - 安装需要小心和规划,否则将来会引起很多问题。这不是你应该考虑使用EXE文件自动安装的东西!



单用户系统要简单得多:SQLite,SQL Server Compact(也称为SQL CE)甚至Access数据库都可以非常简单地与EXE一起安装,并且只需要最少的外部组件(大多数安装程序都会自动安装所有这些组件)。



在大多数情况下,数据库系统的代码大致保持不变,只更改您使用的类:SQL Server,SQLiteConnection和SQLiteCommand的SqlConnection和SqlCommand例如,对于SQLite。这取决于您的软件使用的是:某些数据库功能可能并非在所有系统中都可用。
It's going to depend on what you want to do with the database: if you want it being used by multiple people at the same time (a multiuser database) then you will need SQL Server or MySQL. If you only need the database accessed by a single person and not sharing the data with others (a single user database) then you can use a lot simpler system.

SQL Server and MySQL are big, complicated packages - because they are doing a heck of a lot "behind the scenes" to make your data work with multiple users. As a result, they are big, complicated applications that need care and attention when you install them, and are not trivial to install - the installation takes care and planning or you will really cause a lot of problems in the future. This is not something you should consider installing automatically with the EXE file!

Single user systems are a lot simpler: SQLite, SQL Server Compact (also known as SQL CE), and even Access databases can very simply be installed with the EXE and will require a minimum of external components (all of which will be installed automatically for you by most installer programs).

In most cases, the code for the DB system remains largely the same, with only changes to the classes you use: SqlConnection and SqlCommand for SQL Server, SQLiteConnection and SQLiteCommand for SQLite for example. It depends on what your software is using: some database features may not be available in all systems.


这篇关于如何在c#.net中使用数据库创建Windows表单应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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