Re: Programming databases in .NET - please help
- From: "SP" <ecneserpegats@xxxxxxxxxxx>
- Date: Sun, 19 Mar 2006 11:41:06 -0500
<lennon1@xxxxxxxxxxxx> wrote in message
news:1142775347.013030.193600@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi, I have already started learning .NET and I have a question. If I
want to do anything - Display Data, Navigate, Update - with database
(SQL Server) in Visual Studio 2005, do I have to use all this objects :
- DATASET
- sqlDataAdapter
- BindingSource
- sqlConnection
You will need to connect to your database, get the data records, put these
data records in some form of "container" and then display this container.
SqlConnection is what you use to connect to your SQL Server database. If you
might use different databases down the road then program against the
IDbConnection interface rather than the concrete SqlConnection class.
You get the data via a data adpater or a data reader. Data adapters are used
with a dataset, datareaders are generally used with a collection of objects.
For a simple CRUD application (create, read, update, display) then datasets
are popular. If you want to build a business object model then you will use
business classes and collections and populate these collections via the data
reader. Again program against the interfaces not the concrete classes if you
might support different databases, i.e. IDbReader
All list type controls pretty much work with datasets. Collection support is
generally based on vendor supporting certain interfaces like IList. My
experience is that vendors fully support datasets in terms of their "data
awareness" but that collections may require you to implement additonal
interfaces in order to be fully "data aware", e.g. ITypedList. One example
is that adding an item to a collection may require you to tell the list
control to "refresh" in order to see the item but with datasets adding a
datarow to a datatable is all that is needed for the new row to be
"automatically" displayed.
I usually write database applications in Delphi, but now I want to
learn Dot Net platform ant it's quite diffrent than programming
databases in Delphi. Besides I want to make sure that the code I write
is correct.
The most important decision I believe is datasets versus collections. I
myself always use collections and I feel they work with the OO model better.
HTH
SP
Please help me. If you know some good links or discussion group about
programming databases in .NET please give me some.
Thanks
Jethroelp
.
- Follow-Ups:
- Re: Programming databases in .NET - please help
- From: lennon1
- Re: Programming databases in .NET - please help
- References:
- Programming databases in .NET - please help
- From: lennon1
- Programming databases in .NET - please help
- Prev by Date: Re: Size of a class
- Next by Date: Simple Threading Question
- Previous by thread: Re: Programming databases in .NET - please help
- Next by thread: Re: Programming databases in .NET - please help
- Index(es):
Relevant Pages
|