Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Weird dataset.getchanges problem

Reply
 
Old 06-05-2008   #1 (permalink)
John Sheppard


 
 

Weird dataset.getchanges problem

Hello there,

I have the following code; I do this as a work around for a
dataset.haschanges method which doesnt appear to work correctly either

For Each dt As DataTable In myDs.Tables
If Not dt.GetChanges(DataRowState.Added) Is Nothing Then hasChanges=true
If Not dt.GetChanges(DataRowState.Modified) Is Nothing Then
hasChanges=true
If Not dt.GetChanges(DataRowState.Deleted) Is Nothing Then
hasChanges=true
Next

On some (not all) of my datatables in the dataset, Visual Studio is claming
that certain columns do not exist when I hit the first dt.getchanges line.
The column that it claimes does not exist are not in the datatable
(according to the dataset visualiser)
I have tried regenerating my dataset.

Does anyone know what could be going on? I cant figure it out...
Thank you
John



My System SpecsSystem Spec
Old 06-06-2008   #2 (permalink)
Cor Ligthert[MVP]


 
 

Re: Weird dataset.getchanges problem

John,

This sound strange

On some (not all) of my datatables in the dataset, Visual Studio is claming
that certain columns do not exist when I hit the first dt.getchanges line.
The column that it claimes does not exist are not in the datatable
(according to the dataset visualiser)

The GetChanges creates a real copy of your datatable, I have never seen
this, maybe it uses XML serializing behind the scene and then avoid
probably empty columns, can you check that? Would be interesting.

Cor


"John Sheppard" <spam@xxxxxx> schreef in bericht
news:g2ace90115q@xxxxxx
Quote:

> Hello there,
>
> I have the following code; I do this as a work around for a
> dataset.haschanges method which doesnt appear to work correctly either
>
> For Each dt As DataTable In myDs.Tables
> If Not dt.GetChanges(DataRowState.Added) Is Nothing Then
> hasChanges=true
> If Not dt.GetChanges(DataRowState.Modified) Is Nothing Then
> hasChanges=true
> If Not dt.GetChanges(DataRowState.Deleted) Is Nothing Then
> hasChanges=true
> Next
>
> On some (not all) of my datatables in the dataset, Visual Studio is
> claming that certain columns do not exist when I hit the first
> dt.getchanges line. The column that it claimes does not exist are not in
> the datatable (according to the dataset visualiser)
> I have tried regenerating my dataset.
>
> Does anyone know what could be going on? I cant figure it out...
> Thank you
> John
>
My System SpecsSystem Spec
Old 06-10-2008   #3 (permalink)
John Sheppard


 
 

Re: Weird dataset.getchanges problem

Thanks cor, I will check that out and report back. Sorry for the delay, it
was a long weekend here.
John

"Cor Ligthert[MVP]" <notmyfirstname@xxxxxx> wrote in message
news:B2751449-8232-4891-BBFF-0387D6BEA41A@xxxxxx
Quote:

> John,
>
> This sound strange
>
> On some (not all) of my datatables in the dataset, Visual Studio is
> claming
> that certain columns do not exist when I hit the first dt.getchanges line.
> The column that it claimes does not exist are not in the datatable
> (according to the dataset visualiser)
>
> The GetChanges creates a real copy of your datatable, I have never seen
> this, maybe it uses XML serializing behind the scene and then avoid
> probably empty columns, can you check that? Would be interesting.
>
> Cor
>
>
> "John Sheppard" <spam@xxxxxx> schreef in bericht
> news:g2ace90115q@xxxxxx
Quote:

>> Hello there,
>>
>> I have the following code; I do this as a work around for a
>> dataset.haschanges method which doesnt appear to work correctly either
>>
>> For Each dt As DataTable In myDs.Tables
>> If Not dt.GetChanges(DataRowState.Added) Is Nothing Then
>> hasChanges=true
>> If Not dt.GetChanges(DataRowState.Modified) Is Nothing Then
>> hasChanges=true
>> If Not dt.GetChanges(DataRowState.Deleted) Is Nothing Then
>> hasChanges=true
>> Next
>>
>> On some (not all) of my datatables in the dataset, Visual Studio is
>> claming that certain columns do not exist when I hit the first
>> dt.getchanges line. The column that it claimes does not exist are not in
>> the datatable (according to the dataset visualiser)
>> I have tried regenerating my dataset.
>>
>> Does anyone know what could be going on? I cant figure it out...
>> Thank you
>> John
>>
>
My System SpecsSystem Spec
Old 06-11-2008   #4 (permalink)
John Sheppard


 
 

Re: Weird dataset.getchanges problem

Hi Cor,

There are empty columns, but there are also empty columns in datatables that
work....that is, I cant see that they directly relate.

I don't know why, but if I do a merge into a clean dataset beforehand it
works.

It's threaded code and the original dataset comes from a baseform. These
things shouldnt really matter I dont think but maybe that has something to
do with it.For now I'm content to use the workaround below.

'This worked
Dim test As New dsBMS

test.Merge(myDs)
For Each dt As DataTable In test.Tables
If Not dt.GetChanges(DataRowState.Added) Is Nothing Then hasChanges=true
If Not dt.GetChanges(DataRowState.Modified) Is Nothing Then
hasChanges=true
If Not dt.GetChanges(DataRowState.Deleted) Is Nothing Then
hasChanges=true
Next

'This didnt work
For Each dt As DataTable In myDs.Tables
If Not dt.GetChanges(DataRowState.Added) Is Nothing Then hasChanges=true
If Not dt.GetChanges(DataRowState.Modified) Is Nothing Then
hasChanges=true
If Not dt.GetChanges(DataRowState.Deleted) Is Nothing Then
hasChanges=true
Next

Thanks Cor
John


"Cor Ligthert[MVP]" <notmyfirstname@xxxxxx> wrote in message
news:B2751449-8232-4891-BBFF-0387D6BEA41A@xxxxxx
Quote:

> John,
>
> This sound strange
>
> On some (not all) of my datatables in the dataset, Visual Studio is
> claming
> that certain columns do not exist when I hit the first dt.getchanges line.
> The column that it claimes does not exist are not in the datatable
> (according to the dataset visualiser)
>
> The GetChanges creates a real copy of your datatable, I have never seen
> this, maybe it uses XML serializing behind the scene and then avoid
> probably empty columns, can you check that? Would be interesting.
>
> Cor
>
>
> "John Sheppard" <spam@xxxxxx> schreef in bericht
> news:g2ace90115q@xxxxxx
Quote:

>> Hello there,
>>
>> I have the following code; I do this as a work around for a
>> dataset.haschanges method which doesnt appear to work correctly either
>>
>> For Each dt As DataTable In myDs.Tables
>> If Not dt.GetChanges(DataRowState.Added) Is Nothing Then
>> hasChanges=true
>> If Not dt.GetChanges(DataRowState.Modified) Is Nothing Then
>> hasChanges=true
>> If Not dt.GetChanges(DataRowState.Deleted) Is Nothing Then
>> hasChanges=true
>> Next
>>
>> On some (not all) of my datatables in the dataset, Visual Studio is
>> claming that certain columns do not exist when I hit the first
>> dt.getchanges line. The column that it claimes does not exist are not in
>> the datatable (according to the dataset visualiser)
>> I have tried regenerating my dataset.
>>
>> Does anyone know what could be going on? I cant figure it out...
>> Thank you
>> John
>>
>


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Weird - Very weird annoying problem General Discussion
weird problem Vista General
weird problem Vista General
weird problem Vista performance & maintenance
weird problem Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46