PC Review


Reply
Thread Tools Rate Thread

Basic question on CommandBuilder

 
 
Tom Archer
Guest
Posts: n/a
 
      16th Jul 2003
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



 
Reply With Quote
 
 
 
 
William \(Bill\) Vaughn
Guest
Posts: n/a
 
      16th Jul 2003
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.
__________________________________

"Tom Archer" <(E-Mail Removed)> wrote in message
news:0a8401c34ba8$fa9cb9f0$(E-Mail Removed)...
> 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
>
>
>



 
Reply With Quote
 
Tom Archer
Guest
Posts: n/a
 
      16th Jul 2003
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.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
William \(Bill\) Vaughn
Guest
Posts: n/a
 
      16th Jul 2003
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.
__________________________________

"Tom Archer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



 
Reply With Quote
 
Tom Archer
Guest
Posts: n/a
 
      17th Jul 2003
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.
>__________________________________
>
>"Tom Archer" <(E-Mail Removed)> wrote in message
>news:0a8401c34ba8$fa9cb9f0$(E-Mail Removed)...
>> 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
>>
>>
>>

>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CommandBuilder Question... MobileBoy36 Microsoft Dot NET Compact Framework 2 1st Feb 2006 07:52 PM
CommandBuilder Antonio Prieto Microsoft ADO .NET 5 23rd Nov 2004 10:09 AM
CommandBuilder question Sébastien Microsoft ADO .NET 1 17th Feb 2004 06:04 PM
Re: CommandBuilder question William Ryan eMVP Microsoft ADO .NET 2 16th Feb 2004 08:41 PM
Check box validaion question (basic question) paul Microsoft Access Forms 1 3rd Dec 2003 12:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:21 AM.