Basic question on CommandBuilder

T

Tom Archer

Do I have to use the CommandBuilder in order to update a
disconnected DataSet or is there another way?

Here's how my MC++/MFC code currently works:

View::OnInitialUpdate

// Construct SqlConnection
// Construct SqlDataAdapter (stored at view level)
// Construct SqlCommandBuilder (stored at view level)

// Open Connection

// Constuct DataSet (stored at view level)
// Fill DataSet

// Close Connection

// Construct desired DataTable (stored at view level)

View::OnAddRecord

Construct and add DataRow object to DataTable

View::OnDestroy

Call Adapter::Update
 
W

William \(Bill\) Vaughn

While my article on the Command(Don'tUse)Builder is written using VB.NET
examples, the points it makes apply to virtually all languages--even C++.

http://www.betav.com/msdn_magazine.htm

--
____________________________________
Bill Vaughn
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.
__________________________________
 
T

Tom Archer

Hi Bill,

Thanks Bill for your response. However, that certainly seems like a
large amount of work when all I want to do is to commit a couple of new
records to a dataset.

The thing is that I'm attempting to see where ADO.NET might help out MFC
folks like me. Now, if this is the price of having disconnected data
then so be it. However, if there's an easier way to simply synch updates
and insertions, then that's what I'm after.
 
W

William \(Bill\) Vaughn

As I said in the article, you can roll your own updates or simply take the
performance and functionality hit with the CommandBuilder. It's not really a
function of the "disconnected" approach as ADO classic had similar issues at
first, but yet it's a bit more cludgy as ADO.NET has no "built-in" query
generator as ADO classic did (does).

--
____________________________________
Bill Vaughn
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.
__________________________________
 
T

Tom Archer

This was exactly what I needed. Thanks Bill.
-----Original Message-----
While my article on the Command(Don'tUse)Builder is written using VB.NET
examples, the points it makes apply to virtually all languages--even C++.

http://www.betav.com/msdn_magazine.htm

--
____________________________________
Bill Vaughn
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.
__________________________________




.
 

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

Top