how do i connect my data acess layer to database......

Posted by See29ram under ASP.NET on 11/19/2011 | Points: 10 | Views : 933 | Status : [Member] | Replies : 1
i used to give like this "string (str = ConfigurationManager.ConnectionStrings["mydb"].ConnectionString;) " when i moved to realtime projects, " ConfigurationManager" is not coming in me friends.....


Posted by: Sreekanthv5 on: 11/19/2011 [Member] Starter | Points: 25

I think u r using N-Tier or Three Tier architecture. If the DAL is in the same project you can access through web.config file. where when u r using different layer as different project you should use
public class DataAccess
SqlConnection con = new SqlConnection("data source=localhost; DataBase=Northwind; Integrated Security=True");

through web.config file.
string _connStr = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString;

See29ram, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response