I
Igor Zhavrid
Hi!
I have some problem with DataTable.LoadDataRow. Everething was ok untill I
added to the table autoincrement column.
There's some table
<xs:element name="Messung">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:integer" minOccurs="1"
msdata:AutoIncrement="true" msdata:AutoIncrementSeed="1"
msdata:AutoIncrementStep="1" />
<xs:element name="AKZID" type="xs:integer" minOccurs="1" />
<xs:element name="GruppeID" type="xs:integer" minOccurs="0" />
<xs:element name="StartD" type="xs:date" minOccurs="1" />
<xs:element name="EndD" type="xs:date" minOccurs="0" />
<xs:element name="UsrID" type="xs:integer" minOccurs="0" />
<xs:element name="Probenz" type="xs:date" minOccurs="0" />
<xs:element name="Updated" type="xs:boolean" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
and defined PK for it:
<xs:key name="MessungPK" msdatarimaryKey="true">
<xs:selector xpath=".//Messung" />
<xs:field xpath="AKZID" />
<xs:field xpath="GruppeID" />
<xs:field xpath="StartD" />
<xs:field xpath="EndD" />
</xs:key>
In the help it said that "
The LoadDataRow method takes an array of values and finds the matching
value(s) in the primary key column(s).
If a column has a default value, pass a null value in the array to set the
default value for that column. Similarly, if a column has its AutoIncrement
property set to true, pass a null value in the array to set the
automatically generated value for the row."
But when I do like
messRow = dtMessung.LoadDataRow(New Object() {Nothing, newRow(0), newRow(1),
newRow(4), newRow(5)}, True)
the new row is added everytime, though autoincrement ID is not in PK.
Is there solution for the problem?
I have some problem with DataTable.LoadDataRow. Everething was ok untill I
added to the table autoincrement column.
There's some table
<xs:element name="Messung">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:integer" minOccurs="1"
msdata:AutoIncrement="true" msdata:AutoIncrementSeed="1"
msdata:AutoIncrementStep="1" />
<xs:element name="AKZID" type="xs:integer" minOccurs="1" />
<xs:element name="GruppeID" type="xs:integer" minOccurs="0" />
<xs:element name="StartD" type="xs:date" minOccurs="1" />
<xs:element name="EndD" type="xs:date" minOccurs="0" />
<xs:element name="UsrID" type="xs:integer" minOccurs="0" />
<xs:element name="Probenz" type="xs:date" minOccurs="0" />
<xs:element name="Updated" type="xs:boolean" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
and defined PK for it:
<xs:key name="MessungPK" msdatarimaryKey="true">
<xs:selector xpath=".//Messung" />
<xs:field xpath="AKZID" />
<xs:field xpath="GruppeID" />
<xs:field xpath="StartD" />
<xs:field xpath="EndD" />
</xs:key>
In the help it said that "
The LoadDataRow method takes an array of values and finds the matching
value(s) in the primary key column(s).
If a column has a default value, pass a null value in the array to set the
default value for that column. Similarly, if a column has its AutoIncrement
property set to true, pass a null value in the array to set the
automatically generated value for the row."
But when I do like
messRow = dtMessung.LoadDataRow(New Object() {Nothing, newRow(0), newRow(1),
newRow(4), newRow(5)}, True)
the new row is added everytime, though autoincrement ID is not in PK.
Is there solution for the problem?