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