Asp.net连接数据库的配置方法

时间:2022-10-17 13:14:34

1.Sqlserver数据库连接

1 <connectionStrings>
2 <add name="Conn" connectionString="server=.;database=demo;uid=sa;pwd=123456" providerName="System.Data.SqlClient"/>
3 </connectionStrings>

2.Oracle数据库连接

1 <connectionStrings>
2 <add name="Conn" connectionString="Provider=MSDAORA;Data Source=demo;User ID=sa;Password=123456;" providerName="System.Data.OracleClient"/>
3 </connectionStrings>

3.MySql数据库连接

1 <connectionStrings>
2 <add name="Conn" connectionString="host=127.0.0.1;Port=3306;Database=mysql;uid=sa;pwd=12346" providerName="MySql.Data.MySqlClient"/>
3 </connectionStrings>

4.Acces数据库连接

1 <connectionStrings>
2 <add name="Conn" connectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source={0}App_Data/demo.mdb" providerName="System.Data.OleDb"/>
3 </connectionStrings>

5.SQLite数据库连接

1 <connectionStrings>
2 <add name="Conn" connectionString="host=127.0.0.1;Port=3306;Database=mysql;uid=sa;pwd=12346" providerName="MySql.Data.MySqlClient"/>
3 </connectionStrings>

文章来源:http://www.php.cn/csharp-article-376943.html