在.net应用程序中动态本地创建SQL服务器

时间:2021-11-26 10:36:11

There are a lot of examples on how to connect to an SQL server locally, but I failed to find an examples on how to dynamically create a new database instance through a C#/Vb.net win form, is this even possible?

有很多关于如何在本地连接到SQL服务器的示例,但是我没有找到关于如何通过C#/ Vb.net win表单动态创建新数据库实例的示例,这是否可能?

I've developed an application that is used on many computers around my company, my aim is to dynamically create a local database on each machine. I've experimented with SQL CE but found it too slow for our requirements, we have a central SQL server that seems to be faster than a locally hosted SQL CE database, this is why i am exploring the idea of creating a SQL server on each PC instead.

我开发了一个在我公司的许多计算机上使用的应用程序,我的目标是在每台机器上动态创建一个本地数据库。我已经尝试过SQL CE,但发现它对我们的要求来说太慢了,我们有一个*SQL服务器似乎比本地托管的SQL CE数据库更快,这就是为什么我正在探索在每个上创建一个SQL服务器的想法PC而不是。

A locally hosted database is needed so that the application can run offline from the network so that people can take their laptops home and continue to work

需要本地托管的数据库,以便应用程序可以从网络脱机运行,以便人们可以将笔记本电脑带回家并继续工作

1 个解决方案

#1


1  

Unfortunately, I do not have enough actual indepth knowledge to provide a complete answer. The solution is to fill a dataset from the central DB and save it locally on the machine. After the users have made their changes to their local copy offline, you will then need to merge the local copy back to the central instance. You will have to work out a versioning scheme to deal with conflicts from multiple users modifying the same data before merging and committing it with the central DB. This is basically how version control with TFS or Git works in Visual Studio

不幸的是,我没有足够的实际深度知识来提供完整的答案。解决方案是从*数据库填充数据集并将其本地保存在计算机上。用户对其本地副本进行脱机更改后,您需要将本地副本合并回*实例。您必须制定版本控制方案,以便在合并并将其与*数据库提交之前处理来自修改相同数据的多个用户的冲突。这基本上是如何使用TFS或Git在Visual Studio中进行版本控制

#1


1  

Unfortunately, I do not have enough actual indepth knowledge to provide a complete answer. The solution is to fill a dataset from the central DB and save it locally on the machine. After the users have made their changes to their local copy offline, you will then need to merge the local copy back to the central instance. You will have to work out a versioning scheme to deal with conflicts from multiple users modifying the same data before merging and committing it with the central DB. This is basically how version control with TFS or Git works in Visual Studio

不幸的是,我没有足够的实际深度知识来提供完整的答案。解决方案是从*数据库填充数据集并将其本地保存在计算机上。用户对其本地副本进行脱机更改后,您需要将本地副本合并回*实例。您必须制定版本控制方案,以便在合并并将其与*数据库提交之前处理来自修改相同数据的多个用户的冲突。这基本上是如何使用TFS或Git在Visual Studio中进行版本控制