simple update method

  • Thread starter Thread starter Bill H
  • Start date Start date
B

Bill H

One of the things I liked about the old ADO, is the Update method on the
recordset object. it didn't expect you to prepare any update statements, it
just knew how to update the database.

Is ADO.NET able to do this as simplistic as ADO, or does it require Update
statements ?


Thanks
Bill
 
No, and yes...
Keep in mind that ADO classic and ADO.NET are very (very) different.

No, in ADO.NET there is no code that runs behind the scenes to generate the
action commands on the fly when you execute the Update method as was
supported in ADO classic. However, this can be done (after a fashion) at
design time using the Wizards. Unfortunately, these are pretty "challenged"
and often build sub-optimal code.

Yes, you can try to use the CommandBuilder, but it suffers from exactly the
same issues--but costs you a round trip each time it's called. So... yes,
you have to (or should) roll your own action commands.

No, the 2.0 Framework does not improve this design-time-generated code.
hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Thank William,

Could one assume then that Ado.Net is not sufficient an engine to write a
generic database maintenence tool ?
The problem being, a user can create an on-the-fly query and the program
doesn't know ahead of time what tables are involved, like an application.
I want to be able to execute any SQL statement, and assuming its updatable,
be able to issue an update.
Is classic ADO expected to be around for a while ? Does it serve a purpose
beyond Ado.Net ?


Thanks
Bill
 
Hardly. With ADO.NET and the 2.0 version especially, there are a number of
ways to access a variety of backends, learn the schema and permit you to
execute any DML you need.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top