C# Winform项目,客户端数据库连接不通

sxl_88 sxl_88 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
利用.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>
...全文

相关推荐

评论 9
收藏 已收藏
分享
返回顶部
sxl_88
C# 111,129 成员 642,538 内容