asp. net Get the database connection string
- 2021-08-31 07:38:57
- OfStack
1. Add a reference
using System.Configuration;
2. Code
string strConnectionString=ConfigurationManager.AppSettings["LocalConnectionString"].ToString()
3. web. config
<configuration>
<appSettings>
<add key="LocalConnectionString" value="User id=sa;Password=123456;Database=Users;Server=192.168.1.1;Connect Timeout=50;Max Pool size=200;Min pool Size=5"/>
</appSettings>
</configuration>