本文介绍了如何在单个连接(Asp.Net)Sql Server上设置多个数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<add name="HelpdeskConString" connectionString="Data Source=.;Initial Catalog=CasDB;Integrated Security=True"/>







<add name="HelpdeskConString" connectionString="Data Source=.;Initial Catalog=HelpDB;Integrated Security=True"/>







我的网络项目中有两个数据库两个子项目我们想在web配置中同时使用两个数据库..



如何在这种情况下设置条件..?




I have two database in my web projct its containg two sub project we wanted two use both database in web config..

how to set condition in this situation..?

推荐答案


<add name="ConString1" connectionstring="Data Source=.;Initial Catalog=CasDB;Integrated Security=True" />







<add name="Constring2" connectionstring="Data Source=.;Initial Catalog=HelpDB;Integrated Security=True" />


<connectionstrings>
   <add name="Connection1" providername="System.Data.SqlClient" connectionstring="Data Source=Server Name;Initial Catalog=Database1;User ID=Usename;Password=****" />
   <add name="Connection2" providername="System.Data.SqlClient" connectionstring="Data Source=Server Name;Initial Catalog=Database2;User ID=Usename;Password=****" />
 </connectionstrings>


这篇关于如何在单个连接(Asp.Net)Sql Server上设置多个数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 06:38