473,473 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Data access

I'm moving to .Net framework 2.0 from Visual Studio 2002/3 with more time on
desktop apps than ASP.Net, although I have done a small amount in ASP.Net. Is
best practice for ASP.Net now to use the components for data access, or to
build your own connection and command objects in code? I find working with
the designer to be awkward and hard to follow the details, and would like to
know if I really should get used to doing things with components and not in
code. Thanks in advance.
Nov 7 '06 #1
3 1327
Both methods have their place. I would advise you to understand what the
components do, rather than to depend on them, and then use them when
appropriate. If you understand what they do, you should be able to discern
when they are appropriate.

--
HTH,

Kevin Spencer
Microsoft MVP
Ministry of Software Development
http://unclechutney.blogspot.com

I just flew in from Chicago with
a man with a wooden leg named Smith
who shot an elephant in my pajamas.
So I bit him.
"RAR in WA" <RAR in WA@discussions.microsoft.comwrote in message
news:55**********************************@microsof t.com...
I'm moving to .Net framework 2.0 from Visual Studio 2002/3 with more time
on
desktop apps than ASP.Net, although I have done a small amount in ASP.Net.
Is
best practice for ASP.Net now to use the components for data access, or to
build your own connection and command objects in code? I find working with
the designer to be awkward and hard to follow the details, and would like
to
know if I really should get used to doing things with components and not
in
code. Thanks in advance.

Nov 7 '06 #2
Thanks for the reply.

The components seem to wrap up the functionality of dataadapter/command and
connection. If I'm using stored procedures for retreiving data, isn't it more
direct to create the connection and command when I need them, and re-use the
connection if I need another request, instead of using a different
SQLDataSource for each request? Or am I missing something about the SQL data
source?
"Kevin Spencer" wrote:
Both methods have their place. I would advise you to understand what the
components do, rather than to depend on them, and then use them when
appropriate. If you understand what they do, you should be able to discern
when they are appropriate.

--
HTH,

Kevin Spencer
Microsoft MVP
Ministry of Software Development
http://unclechutney.blogspot.com

I just flew in from Chicago with
a man with a wooden leg named Smith
who shot an elephant in my pajamas.
So I bit him.
"RAR in WA" <RAR in WA@discussions.microsoft.comwrote in message
news:55**********************************@microsof t.com...
I'm moving to .Net framework 2.0 from Visual Studio 2002/3 with more time
on
desktop apps than ASP.Net, although I have done a small amount in ASP.Net.
Is
best practice for ASP.Net now to use the components for data access, or to
build your own connection and command objects in code? I find working with
the designer to be awkward and hard to follow the details, and would like
to
know if I really should get used to doing things with components and not
in
code. Thanks in advance.


Nov 7 '06 #3
You're correct in your understanding of what the SqlDataSource component
does. However, it isn't really important whether you're using Stored
Procedures or Queries to fetch data. I'll get into that in a moment, after
reviewing the underlying principles.

Starting from the beginning: Writing software is the process of writing
machine instructions in binary code. As both hardware and software
technology has grown, the ability to write pure machine code has become
impractical. As an answer, beginning with Assembler code, common patterns of
machine code were combined into higher-level human-readable programming
languages. These languages enabled developers to write more code in less
time. Again, as technology continued to grow, various common patterns of
these higher-level language instructions were combined into even
higher-level programming languages and technologies, such as Object-Oriented
Programming, which enables one to encapsulate a vast variety of data and
process into a single "class" entity.

Visual Tool Sets like Microsoft Visual Studio enhance the experience even
more, by providing tools that write programming code for you, enabling you
to use visual tools and drag and drop technology to visually design
components, for which Visual Studio writes the code. Underneath it all,
however, every developer is still, more and more indirectly, writing code.

The SqlDataSource component combines several classes into a component
interface that can be designed visually, and easily performs the most common
types of tasks with ASP.Net web data display pages. It is, however,
configurable in a number of ways. For example, you don't need to just drag
and drop a component onto a page. You can exert more control by writing your
own code. And it exposes properties that can be changed "on the fly," such
as the Connection String, SelectCommand, and SelectParameters. So, while it
might certainly be quicker in the short run to drag several SqlDataSources
onto a page, one for each type of data you might need, it is not always
necessary. One SqlDataSource can function at different times as a
SqlDataSource for a number of different data sources and operations.

Again, the SqlDataSource encapsulates the most common types of data
display/interaction functionalities. It is most useful when building a
visual web interface for working with strictly tabular data, and that is,
indeed, the most common functionality. However, there are many other
less-common types of operations that can be performed with an underlying
data store, and for many of these you will not need the overhead involved in
creating such a large component. In such cases, you might only need, for
example, a Connection, Command, and a DataReader.

That's what I was getting at in my first message. Here are a few links that
should help:

http://msdn2.microsoft.com/en-us/lib...atasource.aspx
http://msdn2.microsoft.com/en-us/lib...e_members.aspx
http://dotnetjunkies.com/QuickStartv...atasource.aspx
http://gridviewguy.com/ArticleDetail...?articleID=147
http://geekswithblogs.net/lorint/arc.../20/70195.aspx

--
HTH,

Kevin Spencer
Microsoft MVP
Ministry of Software Development
http://unclechutney.blogspot.com

I just flew in from Chicago with
a man with a wooden leg named Smith
who shot an elephant in my pajamas.
So I bit him.
"RAR in WA" <RA*****@discussions.microsoft.comwrote in message
news:1C**********************************@microsof t.com...
Thanks for the reply.

The components seem to wrap up the functionality of dataadapter/command
and
connection. If I'm using stored procedures for retreiving data, isn't it
more
direct to create the connection and command when I need them, and re-use
the
connection if I need another request, instead of using a different
SQLDataSource for each request? Or am I missing something about the SQL
data
source?
"Kevin Spencer" wrote:
>Both methods have their place. I would advise you to understand what the
components do, rather than to depend on them, and then use them when
appropriate. If you understand what they do, you should be able to
discern
when they are appropriate.

--
HTH,

Kevin Spencer
Microsoft MVP
Ministry of Software Development
http://unclechutney.blogspot.com

I just flew in from Chicago with
a man with a wooden leg named Smith
who shot an elephant in my pajamas.
So I bit him.
"RAR in WA" <RAR in WA@discussions.microsoft.comwrote in message
news:55**********************************@microso ft.com...
I'm moving to .Net framework 2.0 from Visual Studio 2002/3 with more
time
on
desktop apps than ASP.Net, although I have done a small amount in
ASP.Net.
Is
best practice for ASP.Net now to use the components for data access, or
to
build your own connection and command objects in code? I find working
with
the designer to be awkward and hard to follow the details, and would
like
to
know if I really should get used to doing things with components and
not
in
code. Thanks in advance.



Nov 8 '06 #4

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

Similar topics

8
by: Frnak McKenney | last post by:
Back when computer dinosaurs roamed the earth and the precursors to today's Internet were tiny flocks of TDMs living symbiotically with the silicon giants, tracking access to data processing...
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...
9
by: Tony Lee | last post by:
Some time a ago, on this newsgroup the following comments were made in recommending good references for Access (2003) >I used to recommend Dr. Rick Dobson's, "Programming Access <version>" for...
3
by: Lyle Fairfield | last post by:
In a recent thread there has been discussion about Data Access Pages. It has been suggested that they are not permitted on many or most secure sites. Perhaps, that it is so, although I know of no...
1
by: Johann Blake | last post by:
I am looking for a good solution on how to implement data access in an application so that there is a clean separation between the data access layer, the business layer and the GUI layer. I am...
5
by: jqpdev | last post by:
Hello all... I'm coming from a Borland Delphi background. Delphi has a specific component called a Data Module. In the designer the Data Module behaves like a windows form. A developer can...
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...
3
by: SAL | last post by:
Hi, I have Microsoft Enterprise Library 2005 installed on my local system. I'm developing in C# using Visual Studio 2003 IDE with framework 1.1. I am automating a process that will use a DLL...
2
by: Torilyn73 | last post by:
Alrighty... one problem down... 40 more to go!! (Just kidding.. not really 40.. only 32!) My database needs to be accessible via the web. I have the server information so when its ready I can...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
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...
0
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...
0
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,...
1
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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...

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.