假設數據庫連接字符串在web.config里配置如下對你的DAL項目右鍵添加System.Configuration引用(必須步驟),添加Model項目引用然后在DB類(假設為UserDAL.cs)usingSystem.Configuration;//這個必須.usingModel那個項目publicclassUserDAL{publicconststringConnectionString=ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;publicintInsert(UserInfouser)//Model{SqlConnectionsqlcon=newSqlConnection(ConnectionString);.................}}BLL添加DB和Model項目引用using那個DBpublicclassUserBLL{publicintInsert(UserInfouser){inti=UserDAL.Insert(user);}}
網站導航
- zblogPHP模板zbpkf
- zblog免費模板zblogfree
- zblog模板學習zblogxuexi
- zblogPHP仿站zbpfang