首页 > 代码库 > webconfig中配置各种数据库的连接字符串(转)
webconfig中配置各种数据库的连接字符串(转)
一、在appSettings配置
<appSettings>
<!--SQL Server-->
<!--<add key="SQLString" value="http://www.mamicode.com/Database=MyData;Data Source=NICKYAN-PC;User Id=sa;Password=123123;"/>
<add key="DataDAL" value="http://www.mamicode.com/RedGlovePermission.SQLServerDAL" />-->
<!--My SQL-->
<add key="SqlString" value="http://www.mamicode.com/host=192.168.0.222;userid=root;password=123456;database=hr_db"/>
<add key="DataDAL" value="http://www.mamicode.com/RedGlovePermission.MySqlDAL" />
<!--Oracle-->
<add key="SqlString" value="http://www.mamicode.com/Data Source=NICKYAN-PC;User Id=PB_DB_USER;Password=123123;Integrated Security=no"/>
<add key="DataDAL" value="http://www.mamicode.com/RedGlovePermission.OracleDAL" />
<!--OleDB-->
<add key="SQLString" value="http://www.mamicode.com/Provider=Microsoft.Jet.OLEDB.4.0;Data Source=RedGlovePermission.Web/DB/MyData.mdb;Persist Security Info=False"/>
<add key="DataDAL" value="http://www.mamicode.com/RedGlovePermission.OleDBDAL" />
</appSettings>
二、在connectionStrings配置
<!--SQL Server-->
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
<add name="ConnStr" connectionString="Database=DIS;Server=192.168.1.148;User ID=sa;Password=sa;" providerName="System.Data.SqlClient"/>
<add name="ConnStr" connectionString="Database=DIS;Server=192.168.1.148;User ID=sa;Password=sa;" providerName="System.Data.SqlClient"/>
<!--My SQL-->
<add name="conStr" connectionString="server=localhost;uid=root;pwd=123;database=test"providerName="System.Data.SqlClient"/>
<!--Oracle-->
<add name="TYRCC_connstr" connectionString="Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=china-007cb92da) (PORT=1521))(CONNECT_DATA=http://www.mamicode.com/(SERVICE_NAME=TYNHRK)));User ID=tytc;Password=123456;Unicode=True" providerName="System.Data.OracleClient" />
<add name="ConnectionString" connectionString="Data Source=TYNHRK;User ID=tytc;Password=123456.;Unicode=True" providerName="System.Data.OracleClient" />
<add name="ConnectionString2" connectionString="Expression: test_dataConnectionString" providerName="System.Data.SqlClient" />
webconfig中配置各种数据库的连接字符串(转)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。