如何使 wpf 应用程序在同一网络上从一个 SQL Server 读取数据? [英] How to make wpf apps on same netwrok read data from one SQL Server?

查看:64
本文介绍了如何使 wpf 应用程序在同一网络上从一个 SQL Server 读取数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的计算机上有一个在 Visual Studio 2017 中运行的 C# WPF 应用程序,我正在使用 SQL Server 2014 来保存/选择数据.

I have a C# WPF app running inside Visual Studio 2017 on my computer and I am using SQL Server 2014 to save/select data.

如何在不安装 Visual Studio/SQL Server 的情况下在同一网络上的另一台 Windows 计算机上运行它?此应用程序应从/在我的 SQL Server 中读取/插入数据.

How can I run it on another Windows computer on the same network without installing Visual Studio / SQL Server? This app should read/insert data from/in my SQL Server.

我尝试使用发布选项,但该应用程序无法从我在其他网络电脑上的计算机读取数据.

I tried to using publish option, but the app isn't able to read data from my computer on other network pcs.

此外,我尝试将 bin 复制到其他电脑,但该应用程序仍然无法从 SQL Server 读取数据.

Also, I tried to copy bin to other pcs, but the app still isn't able to read data from SQL Server.

我已经准备好 SQL Server 使用以下链接中的以下步骤接收连接:

I already prepare SQL Server to receive a connection using the following steps on the following link:

如何运行在与局域网相连的其他计算机上使用 SQL Server 数据库的桌面应用程序

也在app.config中,我发现了以下连接字符串:

Also in app.config, I found the following connection string:

  connectionString="Data Source=DESKTOP-QO2VUSP\SQLEXPRESS;Initial Catalog=AJFactory;Integrated Security=True"

我检查了其他电脑的事件处理程序,发现以下错误:

I Checked the Event handler from other pcs, I find the following Errors:

应用:工厂App.exe框架版本:v4.0.30319描述:进程因未处理的异常而终止.异常信息:System.Data.SqlClient.SqlException 在System.Data.SqlClient.SqlInternalConnectionTds..ctor(System.Data.ProviderBase.DbConnectionPoolIdentity,System.Data.SqlClient.SqlConnectionString,System.Data.SqlClient.SqlCredential, System.Object, System.String,System.Security.SecureString,布尔值,System.Data.SqlClient.SqlConnectionString,System.Data.SqlClient.SessionData,System.Data.ProviderBase.DbConnectionPool, System.String, Boolean,System.Data.SqlClient.SqlAuthenticationProviderManager

Application: Factory App.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.Data.SqlClient.SqlException at System.Data.SqlClient.SqlInternalConnectionTds..ctor(System.Data.ProviderBase.DbConnectionPoolIdentity, System.Data.SqlClient.SqlConnectionString, System.Data.SqlClient.SqlCredential, System.Object, System.String, System.Security.SecureString, Boolean, System.Data.SqlClient.SqlConnectionString, System.Data.SqlClient.SessionData, System.Data.ProviderBase.DbConnectionPool, System.String, Boolean, System.Data.SqlClient.SqlAuthenticationProviderManager

以及以下内容:

故障应用程序名称:Factory App.exe,版本:1.0.0.0,时间戳:0x5bdb0efa 错误模块名称:KERNELBASE.dll,版本:10.0.17134.319,时间戳:0x5ea0e53d 异常代码:0xe0434352 故障偏移:0x001117d2

Faulting application name: Factory App.exe, version: 1.0.0.0, time stamp: 0x5bdb0efa Faulting module name: KERNELBASE.dll, version: 10.0.17134.319, time stamp: 0x5ea0e53d Exception code: 0xe0434352 Fault offset: 0x001117d2

推荐答案

您需要设置 Integrated Security=False 然后当它为 false 时,您需要指定 User IDPassword 在连接字符串中,有关集成安全的更多信息,请查看以下答案:

You need to set Integrated Security=False then When it false,you need to specified the User ID and Password in the connections string, For more info about Integrated Security, Check the following Answer:

集成安全有什么区别= 真正的集成安全性 = SSPI?

这篇关于如何使 wpf 应用程序在同一网络上从一个 SQL Server 读取数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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