how to create data access layer

Posted by Sagarp under C# on 1/15/2010 | Views : 11878 | Status : [Member] | Replies : 5
Hi



plz reply how to create data access layer in C#



thanks
sagarp

Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/



Responses

Posted by: Abhi2434 on: 1/15/2010 [Member] [Microsoft_MVP] [MVP] Silver

Up
0
Down
Just create a class library and way all your database access code through it.

Dont put anything that calls database to your current application(Presentation Layer) and just expose few methods from the dll and call them to get data.

Preferably you need to create independent modules for database access. Dont mix up the presentation component (like sending Datagrid in Data layer etc) with DataAccess Layer.

Cheers.

www.abhisheksur.com

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

Posted by: Vuyiswamb on: 1/15/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
I once Written Article about the Subject. Basically your DAL(Data Access Layer) in C# is Created as a Class library that get Accessed by the BLL(Business Logic Layer) and that gets Accessed by the PL(Presentation Layer)

here are the Articles

http://www.codeproject.com/KB/vb/N-Tier_Application_VB.aspx

http://www.codeproject.com/KB/cs/N-Tier22.aspx

http://www.codeproject.com/KB/cs/NTier.aspx

Thank you for posting at Dotnetfunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

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

Posted by: Raja on: 1/15/2010 [Member] Starter

Up
0
Down
Please first try to search a bit on the topic you want to ask, this would help you getting more information about it.

Below article from this website will hep you. This has source code as well so you can download and see that how it works.

http://www.dotnetfunda.com/articles/article71.aspx

http://www.dotnetfunda.com/articles/article71.aspx


Thank you.

Regards,
Raja, USA

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

Posted by: Puneet20884 on: 1/15/2010 [Member] Bronze

Up
0
Down
There are so many of the ways for it but better to keep the most of the methos in this class or classes under the DB layer namespace as Static so that they may be directly accessible without object.

There are so many ready made layers for DB, you may follow them either to build your own or can use them.

Best Regards,
Puneet Sharma - Infosys
Pune, India

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

Posted by: Sagarp on: 1/15/2010 [Member] Bronze

Up
0
Down
thx

Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/

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

Login to post response