PC Review


Reply
Thread Tools Rate Thread

DataSet.Merge where data being merge has less rows than the oringal source

 
 
Dan Hibbert
Guest
Posts: n/a
 
      18th Jan 2005
Hi,
I'm having a bit of difficulty with the merge command. The situation is:

I have a table of data with 15 rows. I've run some code to get some data
from SAP - I then convert the SAPtable to an ADO DataTable which has 14
rows. When I run the following:

CurrencyAdapter.fill(dsCurrency)
dsCurrency.Merge(dsSAPCurrency)

The number of rows is still 15. The row that I want to get rid of has a
rowstate of unchanged so when I call CurrencyAdapter.Update(dsCurrency), it
is not deleted.

Is there a method of merging data that would make the unwanted row have a
rowstate of deleted? Or have I gone about this the wrong way? I did think
of locking the table in a transaction, deleting all the data then running
Update so that only the records I've got from SAP will be added.

Any help much appreciated .

Dan


 
Reply With Quote
 
 
 
 
Miha Markic [MVP C#]
Guest
Posts: n/a
 
      19th Jan 2005
Hi Dan,

You are right - Merge only merges and won't delete rows.
You'll have to do it manually (a loop....)

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

"Dan Hibbert" <(E-Mail Removed)> wrote in message
news:eONXOKZ$(E-Mail Removed)...
> Hi,
> I'm having a bit of difficulty with the merge command. The situation
> is:
>
> I have a table of data with 15 rows. I've run some code to get some data
> from SAP - I then convert the SAPtable to an ADO DataTable which has 14
> rows. When I run the following:
>
> CurrencyAdapter.fill(dsCurrency)
> dsCurrency.Merge(dsSAPCurrency)
>
> The number of rows is still 15. The row that I want to get rid of has a
> rowstate of unchanged so when I call CurrencyAdapter.Update(dsCurrency),
> it is not deleted.
>
> Is there a method of merging data that would make the unwanted row have a
> rowstate of deleted? Or have I gone about this the wrong way? I did
> think of locking the table in a transaction, deleting all the data then
> running Update so that only the records I've got from SAP will be added.
>
> Any help much appreciated .
>
> Dan
>
>



 
Reply With Quote
 
Dan Hibbert
Guest
Posts: n/a
 
      20th Jan 2005
Hi Miha,
Thanks for the info - that's what I did in the end - would have been
nice to find a funkier method!

"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:OWlRlQg$(E-Mail Removed)...
> Hi Dan,
>
> You are right - Merge only merges and won't delete rows.
> You'll have to do it manually (a loop....)
>
> --
> Miha Markic [MVP C#] - RightHand .NET consulting & development
> SLODUG - Slovene Developer Users Group
> www.rthand.com
>
> "Dan Hibbert" <(E-Mail Removed)> wrote in message
> news:eONXOKZ$(E-Mail Removed)...
>> Hi,
>> I'm having a bit of difficulty with the merge command. The situation
>> is:
>>
>> I have a table of data with 15 rows. I've run some code to get some data
>> from SAP - I then convert the SAPtable to an ADO DataTable which has 14
>> rows. When I run the following:
>>
>> CurrencyAdapter.fill(dsCurrency)
>> dsCurrency.Merge(dsSAPCurrency)
>>
>> The number of rows is still 15. The row that I want to get rid of has a
>> rowstate of unchanged so when I call CurrencyAdapter.Update(dsCurrency),
>> it is not deleted.
>>
>> Is there a method of merging data that would make the unwanted row have a
>> rowstate of deleted? Or have I gone about this the wrong way? I did
>> think of locking the table in a transaction, deleting all the data then
>> running Update so that only the records I've got from SAP will be added.
>>
>> Any help much appreciated .
>>
>> Dan
>>
>>

>
>



 
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
Need help updating my dataset with changes made on the Source? Getchanges Merge? mike11d11 Microsoft VB .NET 6 16th Oct 2006 05:28 AM
Can not add rows into dataset using Merge() muntyanu@hotmail.com Microsoft C# .NET 2 13th Dec 2005 08:46 PM
how do i get my mail merge to update the data source at each merge =?Utf-8?B?U3RlZWxfTW9ua2V5?= Microsoft Excel Misc 0 30th Nov 2005 08:41 AM
How to merge a subset of rows from one dataset to another moondaddy Microsoft ADO .NET 1 8th Apr 2005 08:05 AM
DataSet.Merge / auto number on PK -> duplicated rows problem Benjamin Microsoft ADO .NET 9 23rd Jul 2004 05:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:00 AM.