SqlDataSource Control vs Connecting to a Database Programmatically

D

dcship

I’m new to working with ASP.NET. I am currently working with a contractor on
a project for my company. He seems to prefer to use older methods for doing
things such as datagrids instead of gridviews, and SqlDataAdapter in code
instead of SqlDataSource Control. What are the advantages and disadvantages
to both methodologies? Should I try to get him to use the newer methods?
Thanks in advance for your help with this.
 
M

Mark Rae [MVP]

I’m new to working with ASP.NET. I am currently working with a contractor
on
a project for my company. He seems to prefer to use older methods for
doing
things such as datagrids instead of gridviews, and SqlDataAdapter in code
instead of SqlDataSource Control. What are the advantages and
disadvantages
to both methodologies?

DataGrids have been deprecated in favour of GridViews since ASP.NET v2 -
they definitely should not be used.

Personally, I never go anywhere near the SqlDataSource "training wheels"
controls. I have a DAL (database abstraction layer) which I use for
everything, and can be dropped unmodified into any .NET project whether
WinForms, WebForms or whatever. It's based on this:
http://www.microsoft.com/downloads/...F7-DD16-448B-A152-9845760D9B4C&displaylang=en

Should I try to get him to use the newer methods?

Any ASP.NET developer who would use DataGrids in preference to GridViews in
2010 needs to be treated with extreme suspicion, IMO...
 
J

JohnE

Mark Rae said:
DataGrids have been deprecated in favour of GridViews since ASP.NET v2 -
they definitely should not be used.

Personally, I never go anywhere near the SqlDataSource "training wheels"
controls. I have a DAL (database abstraction layer) which I use for
everything, and can be dropped unmodified into any .NET project whether
WinForms, WebForms or whatever. It's based on this:
http://www.microsoft.com/downloads/...F7-DD16-448B-A152-9845760D9B4C&displaylang=en



Any ASP.NET developer who would use DataGrids in preference to GridViews in
2010 needs to be treated with extreme suspicion, IMO...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

.

Mr Rae, I am looking at casting off the "training wheels" at my next
conversion, which will be sometime in the next 60 days or so. I have
installed the info from the link. Can you be more specific as to what your
DAL is based on? Also, are you willing to elaborate further about not
needing to modify it when it is used? How/what did you do to make it that
way?
John
 
M

Mark Rae [MVP]

Hi John,

Just Mark, please... :)

I am looking at casting off the "training wheels" at my next conversion

That's excellent news!

I have installed the info from the link. Can you be more specific as to
what your
DAL is based on?

It is based on the Microsoft DAAB and uses the factory pattern. This means
that it supports multiple back-end databases at the same time without
needing to modify anything "further up the line", if you see what I mean.
Currently, it supports SQL Server, SqlCe, Jet (and, by extensions, virtually
any OleDb RDBMS), Oracle and MySql since they are the only RDBMS I've ever
needed to use thus far. If my next contract involves, say, Sybase or
Postgre, then they will be added to the DAL.

Also, are you willing to elaborate further about not needing to modify it
when it is used?

Again, that is part of the factory pattern. Every call to the DAL fetches
the connection string from the config file, whether that be web.config or
MyCoolWinFormsApp.config - it makes no difference, since the
ConfigurationSettings calls are the same across all .NET apps.

See here for further details:
http://msdn.microsoft.com/en-us/magazine/cc163766.aspx#S5
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top