473,655 Members | 3,063 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2380
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.D ata

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...writin g 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*******@yaho o.nospammin.com > wrote in message
news:95******** *************** ***********@mic rosoft.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
5755
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 modified that is to upgrade a big, more than 100,000 lines DOS based program developed by FoxPro 2.x to .NET platform. The design is as previous and the implementation will be reprogrammed. As a duty in my job I should find an answer about the
0
5394
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 Application Block (DAAB) in our .Net projects. We use SqlHelper in SQL based projects, and OracleHelper in Oracle based ones. OracleHelper was not published officially by Microsoft as part of the DAAB but it was given as a helper code in a sample .Net...
2
2207
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 access the database layer. However, the code works in a pretty cumbersome and ungeneric way. Basically every query, update, and insert has its own function. So you see a lot of functions like webService.InsertCustomer(name, age, phone); or...
7
2146
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
3013
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 objects and how to implement them with c#? I would appreciate any help. How can i decide that what things go into business layer and what
13
2065
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 DAL found 3 records in the table then it sends a generic collection of 3 objects to the BLL (Business Logic Layer). But here is the problem:
17
46514
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: The goal of this tutorial is to design a Data Abstraction Layer (DAL) in PHP, that will allow us to ignore the intricacies of MySQL and focus our attention on our Application Layer and Business Logic. Hopefully, by the end of this guide, you will...
3
8280
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. The connection string that it uses is stored in the My Project folder under Settings.settings. My business layer contains objects that consume the data layer to read/ write information...pretty basic. My question is....how do I tell the data...
17
5555
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 in that chapter and create a socket connection between my desktop and laptop. However, these two computers are already connected on my home network (using the Windows Network Setup Wizard), so I was wondering if this will have any effect on what...
0
8296
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8497
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8598
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7310
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2721
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1928
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1598
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.