473,385 Members | 1,531 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Creating Data access layer in ASP.NET 1.1

hello, how ru all
pls tell me how can i create DAL and how can i use it in my ASP.NET pages
thanks
Jan 30 '06 #1
2 2362
asad,
I'd suggest that before you set out to write a DAL, download and play around
with the MS Data Access Application Block V2 here:

http://www.microsoft.com/downloads/d...displaylang=en

I have used this for most of my SQL Server data access for several years,
and it's saved me hundreds of mindless hours writing database access code.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"asad" wrote:
hello, how ru all
pls tell me how can i create DAL and how can i use it in my ASP.NET pages
thanks

Jan 30 '06 #2

The Application Block is a DataLayer "Helper".

You still need to write a DataLayer.

The DataLayer tier is the one which communicates with the DataStore (most
often a DataBase, but a DataStore can be any thing which stores data, a
database, a xml file, an excel file, a text file, even a USB device with
probes on it). But most times, the database is the DataStore.

Create a new Assembly.

MyApplication.Data

The role of the DataLayer is to interact with the DataStore.

My general rule of thumb is that the DataLayer returns:

DataSets (plain ole DataSets, or strongly typed ones)
IDataReaders
A single value (scalars)
Nothing (void or sub in C# / Vb.net)

A DataSet is where you get data from the database, and you put the whole
shooting match in memory.

An IDataReader is where you get a "fire hose" of the data, a forward only, 1
row at a time. This is faster than the DataSet, because of less overhead.

A single value (scalar) is when you return a value from the database.
(Like, you do "Select count(*) from dbo.Emp"....all you want is the count)

The returns nothing..... is when you run insert, update, or delete queries
on the database. You're usually sending Data INTO the database, and not
really wanting anything back.. You just want to know it worked.

...
If you follow these rules, you can have a datalayer object.

Then.... you business layer calls/uses the datalayer object.

Think of it like this:
the data layer is meant to abstract how you talk to the database. Say
today, you're using Sql Server. A month from now your boss says your
company's CEO played golf with the Oracle president. and your company is
switching to Oracle. ( A dumb reason, but a reason none-the-less).

Because you had the foresight to author a correct datalayer object, the only
code you need to change is INSIDE the datalayer.
Because you sent generic things like DataSet, IDataReader, Scalars and
nothing back to your business layer..... you can make the change to Oracle
fairly quickly.

You'll definately have to change the code inside your DataLayer object, but
that should be it. Your business layer doesn't change. The business layer
doesn't care ~how you populated the DataSet, IDataReader (etc etc), it only
cares that it WAS populated.
Whether the DataSet, IDataReader was populated by Sql Server, Oracle,
Access, Excel, a text file, an xml file becomes irrelevant to the business
layer.

I hope that helps.

Now, to make your life easier...writing your datalayer, there are "helpers".

http://msdn.microsoft.com/library/?u...ml/EntLib2.asp
(2.0)

http://www.microsoft.com/downloads/d...displaylang=en
(1.1)

The Enterprise Library does alot of the redundant database calls for you.
Its worth a $1,000,000 to learn how to use it.
It makes writing your DataLayer object much much easier.
Good luck!

...


"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:95**********************************@microsof t.com...
asad,
I'd suggest that before you set out to write a DAL, download and play
around
with the MS Data Access Application Block V2 here:

http://www.microsoft.com/downloads/d...displaylang=en

I have used this for most of my SQL Server data access for several years,
and it's saved me hundreds of mindless hours writing database access code.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"asad" wrote:
hello, how ru all
pls tell me how can i create DAL and how can i use it in my ASP.NET pages
thanks

Jan 30 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Hamed | last post by:
Hello I have employed as a developer in a software company that its team uses FoxPro / VB 6.0 / VC++ 6.0 as the developing tools and newly is going to migrate to VS.NET. There is a project...
0
by: sedefo | last post by:
I ran into this Microsoft Patterns & Practices Enterprise Library while i was researching how i can write a database independent data access layer. In my company we already use Data Access...
2
by: headware | last post by:
I'm relatively new to ASP.NET and ADO.NET, but I have a basic design question regarding the use of web services and APS.NET applications. Right now we have an application that uses web services to...
7
by: Robin | last post by:
In a current .Net solution (using VB.Net) has a 3 tier architecture of Web interface, Data Access Layer and Database. How do I implement business logic and class layers into this solution?
4
by: pratham | last post by:
Hi! I'm making a database application and i heard from a friend that it is more proffecional and easy to do this with bussines objects. Can anyone tell me where i can find more info on bussines...
13
by: Jeff | last post by:
Hey ASP.NET 2.0 I'm designing the DAL (Data Access Layer) of my web application. I want every table to have a strongly typed object as wrapper arround the table. So that for example if the...
17
Motoma
by: Motoma | last post by:
This article is cross posted from my personal blog. You can find the original article, in all its splendor, at http://motomastyle.com/creating-a-mysql-data-abstraction-layer-in-php/. Introduction:...
3
by: daokfella | last post by:
In my solution, I have a project that is my data access layer. This layer simply consists of strongly-typed datasets created by dragging tables from the server explorer into the dataset designer....
17
by: John Salerno | last post by:
Let me see if this question even makes sense...I'm reading Core Python Programming and I jumped ahead to the more specific topics like network programming. I plan to follow along with the example...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.