如何使用mdf数据库生成我的C#项目的可执行文件。请详细说明 [英] How to make executable of my C# project with mdf database. Please give detail instructions

查看:121
本文介绍了如何使用mdf数据库生成我的C#项目的可执行文件。请详细说明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作我的C#项目的exe文件,里面有一个mdf数据库。我想要一个可以在任何PC上运行而不需要安装SQL服务器的exe。



我尝试过:



我尝试过设置我的项目,但是当我在其他PC上安装我的应用程序时出现此错误。

发生与网络相关或特定于实例的错误建立与sql server的连接时,未找到服务器或无法访问服务器。验证实例名称是否正确,并且SQL服务器 配置为允许远程连接。 (提供程序:SQL网络接口,错误 52   - 无法找到本地数据库运行时安装。验证SQL服务器Express 是否正确安装并且本地数据库运行时功能已启用 

解决方案

< blockquote>错误消息告诉你该怎么做:

Quote:

验证SQL sever Express是否正确安装并且本地数据库运行时功能已启用

详细说明可在 SQL Server 2016 Express LocalDB [ ^ ]。



Quote:

我想要一个可以在任何PC上运行的exe而无需安装SQL服务器

Fo r只读访问您可以查看 GitHub - Improvedk / OrcaMDF:MDF文件的C#解析器。允许您从MDF文件中读取表,元数据和索引,而无需将其附加到正在运行的SQL Server实例。 [ ^ ]。



如果您不想在客户端计算机上安装 LocalDB 您可以使用不需要专用服务器进程即可访问的其他数据库格式(例如,使用OleDB提供程序;但即使这样,您通常也必须安装该提供程序)。


I want to make exe of my C# project which has a mdf database in it. I want an exe that can run on any PC without need to install SQL server.

What I have tried:

I have tried on make setup of my project but i get this error when i install my app on other PCs.

a network-related or instance-specific error occurred while establishing a connection to sql server, The sever was not found or was not accessible. Verify that the instance name is correct and that SQL sever is configured to allow remote connections. (Provider: SQL network intefaces, error 52 - Unable to locate a Local Database runtime installation. Verify that SQL sever Express is Properly installed and that the Local Database runtime feature is enabled

解决方案

The error message tells you what to do:

Quote:

Verify that SQL sever Express is Properly installed and that the Local Database runtime feature is enabled

Detailed instructions can be found at SQL Server 2016 Express LocalDB[^].

Quote:

I want an exe that can run on any PC without need to install SQL server

For read-only access you may have a look at GitHub - improvedk/OrcaMDF: A C# parser for MDF files. Allows you to read tables, metadata and indexes from MDF files without it being attached to a running SQL Server instance.[^].

If you don't want to install LocalDB on the client machines you can use a different database format that can be accessed without a dedicated server process (e.g. using an OleDB provider; but even then you usually have to install that provider).


这篇关于如何使用mdf数据库生成我的C#项目的可执行文件。请详细说明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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