Home All Groups Group Topic Archive Search About

GetChanges gives null column value in error

Author
22 Feb 2006 3:04 PM
kcakebread
Using VB 2005, I have a strongly typed dataset (from a .xsd file in my
project).

When I load data into this dataset, the immediate window shows:
?ds.TableX(0).IstheFieldNull
True

So, dutifully, I give it a value:
ds.TableX(0).theField = "testabc123"

I can look in the immediate window and see:
?ds.TableX(0).IstheFieldNull
False
?ds.TableX(0).theField
"testabc123"

However, I can also see:
?CType(ds.GetChanges, dsObjectType).TableX(0).IstheFieldNull
True

Clearly, GetChanges() recognized the TableX(0) row was modified, but it
failed to include my column value.  Furthermore, if I:
ds.writexml("c:\ds.xml")
ds.GetChanges().WriteXML("c:\dschanges.xml")

I see that the row of interest is in the XML, but the column is
actually missing (ie null).

Anyone have any ideas?

Kerry

Author
22 Feb 2006 5:08 PM
AMDRIT
Just to ask the obviously basic, did you BeginEdit and EndEdit the row?
GetChanges should reflect the modified values and no the original values.

CType(ds.GetChanges, dsObjectType).TableX(0).IstheFieldNull, will not
necessarily be the row you think it is, as this is a subset of your original
table.

try this

if ds.TableX.rows(0).IstheFieldNull then
  ds.TableX.rows(0).beginedit
  ds.TableX.rows(0)("TheField") = "SomeValue"
  ds.TableX.rows(0).endedit
  debug.writeline(ds.TableX.rows(0).rowstate)
end if




<kcakebr***@gmail.com> wrote in message
Show quoteHide quote
news:1140620668.463613.111850@g44g2000cwa.googlegroups.com...
> Using VB 2005, I have a strongly typed dataset (from a .xsd file in my
> project).
>
> When I load data into this dataset, the immediate window shows:
> ?ds.TableX(0).IstheFieldNull
> True
>
> So, dutifully, I give it a value:
> ds.TableX(0).theField = "testabc123"
>
> I can look in the immediate window and see:
> ?ds.TableX(0).IstheFieldNull
> False
> ?ds.TableX(0).theField
> "testabc123"
>
> However, I can also see:
> ?CType(ds.GetChanges, dsObjectType).TableX(0).IstheFieldNull
> True
>
> Clearly, GetChanges() recognized the TableX(0) row was modified, but it
> failed to include my column value.  Furthermore, if I:
> ds.writexml("c:\ds.xml")
> ds.GetChanges().WriteXML("c:\dschanges.xml")
>
> I see that the row of interest is in the XML, but the column is
> actually missing (ie null).
>
> Anyone have any ideas?
>
> Kerry
>