如何将基于服务器的数据库转换为本地数据库(MDF到SDF)C#? [英] How to convert server based database to local database(MDF to SDF) C#?

查看:85
本文介绍了如何将基于服务器的数据库转换为本地数据库(MDF到SDF)C#?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!如果没有安装SQL Server,Windows应用程序c#无法连接到数据库。我在visual studio(2013)c#中创建了一个Windows窗体应用程序,用于客户信息。使用SQL创建数据库,然后使用数据源导入到visual studio。

但是如果没有安装SQL Server,它就无法运行。可能是我需要某种MDF到SDF转换,但不需要服务器数据库只需要本地数据库。



我尝试过:



不知道该怎么办?我搜索了很多,但可能不幸找到合适的答案。请帮帮我。

Hello! Windows application c# cannot connect to database without SQL server installed. I created a windows form application in visual studio(2013) c#, for customers info. Created database with SQL and then imported to visual studio with data sources.
But its not working without SQL server install. May be i need some sort of MDF to SDF conversion, but do not need a server database just local database is required.

What I have tried:

Have not idea what to do? I searched alot but may be not lucky to find a suitable answer. Please help me out.

推荐答案

SQL Server是一个多用户系统 - 需要安装。

如果你打算使用你的数据库不止一个用户,您应该安装SQL Server并使用它。



如果你只有一个用户 - 完全没有数据共享 - 那么SQL Server对于这类应用来说是一个沉重的野兽,但你必须改变你的消除它的代码。

此时,您可以选择使用哪个数据库:SqLite,Sql Express,甚至是Access。您将需要修改代码以使用适用于所选数据库的相应Connection,Command和DataAdapter类,但如果您的代码编写得很好,并且不会对数据库执行任何操作,那么它将非常顺利。 标准SQL命令通常很好,但很少有单个用户系统支持存储过程。
SQL Server is a multiuser system - and requires installation.
If you are planning on using your DB for more than one user, you should have SQL Server installed and use it.

If you are only ever having a single user - no data sharing at all - then SQL Server is a heavy beast for such apps, but you will have to change your code to eliminate it.
At that point, you can choose which database to use instead: SqLite, Sql Express, or even Access. You will need to modify your code to use the appropriate Connection, Command, and DataAdapter classes for your selected DB, but it will all go pretty smoothly provided your code is written well, and doesn't do anything fancy with the DB. "Standard" SQL commands are generally fine, but few single user systems support stored procedures for example.


这篇关于如何将基于服务器的数据库转换为本地数据库(MDF到SDF)C#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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