C# Winform项目,客户端数据库连接不通
利用.net C#程序给用户开发了C/S版的桌面应用程序,由于在用户的本地需要存储数据,就选择了安装MSSQL_2008R2_EXPRESS简化版的SQL数据库。
目前遇到如下问题:
安装好打包的桌面应用程序以及简化版的SQL数据库后,发现需要更改连接数据源的地址。有部分用户数据源的地址可能用localhost,还有部分用户需要设置用户电脑的机器名。请问该如何设置,谢谢!
App.config文件配置如下:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<!--文件数据库 SQL Server-->
<add key="ConnString" value="Data Source=localhost;Initial Catalog=db;Integrated Security=True;" /> </appSettings>
<!--<system.diagnostics>
<switches>
-->
<!--调试模式开关, <add key="ConnString" value="Data Source=172.10.11.41;Initial Catalog=Jzcy;User Id=sa;Password=sa;Integrated Security=false;" />
true为开启,程序在发生异常时,会在运行目录中生成一个日志文件 .\\Log\20140910.log
false为关闭
-->
<!--
<add name="DebugOutput" value="true" />
</switches>
</system.diagnostics>-->
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
</configuration>
目前遇到如下问题:
安装好打包的桌面应用程序以及简化版的SQL数据库后,发现需要更改连接数据源的地址。有部分用户数据源的地址可能用localhost,还有部分用户需要设置用户电脑的机器名。请问该如何设置,谢谢!
App.config文件配置如下:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<!--文件数据库 SQL Server-->
<add key="ConnString" value="Data Source=localhost;Initial Catalog=db;Integrated Security=True;" /> </appSettings>
<!--<system.diagnostics>
<switches>
-->
<!--调试模式开关, <add key="ConnString" value="Data Source=172.10.11.41;Initial Catalog=Jzcy;User Id=sa;Password=sa;Integrated Security=false;" />
true为开启,程序在发生异常时,会在运行目录中生成一个日志文件 .\\Log\20140910.log
false为关闭
-->
<!--
<add name="DebugOutput" value="true" />
</switches>
</system.diagnostics>-->
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
</configuration>
...全文
相关推荐
C# WinForm客户端连接 WebSocket
基于VS2019,使用WinForm作为WebSocket客户端,连接WebSocket服务器并进行数据通信。
C# WinForm项目实战:Excel导入数据库功能实现指南
C#(发音为 “看-“)是一种简单、现代且面向对象的编程语言,由微软开发。它是.NET平台的主要编程语言,设计时充分考虑了安全性、类型安全和现代编程需求。C#的基本语法包括变量声明、条件语句、循环结构、方法定义等。掌握C#基础语法对于后续学习WinForm控件使用和开发高效的Windows应用程序至关重要。
C# WEBAPI 及winform调用
webapi 项目平台,包含接口生成,及接口调用方法,项目代码清晰明了,非常值得初学者参考借鉴,更具体的开发步骤可以登入我的博客查看:http://www.cnblogs.com/gudaozi/p/8384734.html
c# WinForm 使用Socket实现简单实现服务端与客户端连接,实现消息发送,服务器客户端重连
c# WinForm 使用Socket实现简单实现服务端与客户端连接,实现消息发送,服务器断开后,重启。客户端重连
c# winform 实现 登陆界面 连接sqlserver2005数据库
c# winform 实现登陆界面 链接sqlserver数据库


