Code
<configuration>
<appSettings>
<add key="userName" value="admin"/>
<add key="userPass" value="admin"/>
</appSettings>
<connectionStrings>
<add name="TangCompanyConn" connectionString="Data Source=WANGKUN\SQLEXPRESS;Initial Catalog=TangCompany;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
对webconfig中数据的的提取:
private static readonly string strConn = ConfigurationManager.ConnectionStrings["TangCompanyConn"].ConnectionString;
private static readonly string strName = ConfigurationManager.AppSettings["userName"].ToString();
private static readonly string strPass = ConfigurationManager.AppSettings["userPass"].ToString();
一只站在树上的鸟儿,从来不会害怕树枝会断裂,因为它相信的不是树枝,而是它自己的翅膀。与其每天担心未来,不如努力做好现在。