M
Miky
I have the following problem:
I am populating a dataset but, sometimes (NOT always), the
NewRow method works like the Add method.
SetRightDetail.RightDetail.Rows.Clear()
For Each Right In TblRight.Rows
With Right
Detail = SetRightDetail.RightDetail.NewRow() (1)
Detail.Item("PKID") = .Item("PKID") (2)
Detail.Item("Type") = .Item("Type")
SetRightDetail.RightDetail.Rows.Add(Detail) (3)
End With
Next
Following is one example of the results after the lines
1,2,3 are executed:
Right.Item("PKID") Detail.Item("PKID")
NewRow Result
Iter 1:
(1) 1 DBNull
DBNull OK
(2) 1 1
DBNull OK
(3) 1 1
1 OK
Iter 2:
(1) 2 DBNull
DBNull OK
(2) 2 2
2 WRONG
(3) Generates an exception error for
duplicated primary key WRONG
What can I do to avoid the problem?
Thanks in advance,
LDV-ME
I am populating a dataset but, sometimes (NOT always), the
NewRow method works like the Add method.
SetRightDetail.RightDetail.Rows.Clear()
For Each Right In TblRight.Rows
With Right
Detail = SetRightDetail.RightDetail.NewRow() (1)
Detail.Item("PKID") = .Item("PKID") (2)
Detail.Item("Type") = .Item("Type")
SetRightDetail.RightDetail.Rows.Add(Detail) (3)
End With
Next
Following is one example of the results after the lines
1,2,3 are executed:
Right.Item("PKID") Detail.Item("PKID")
NewRow Result
Iter 1:
(1) 1 DBNull
DBNull OK
(2) 1 1
DBNull OK
(3) 1 1
1 OK
Iter 2:
(1) 2 DBNull
DBNull OK
(2) 2 2
2 WRONG
(3) Generates an exception error for
duplicated primary key WRONG
What can I do to avoid the problem?
Thanks in advance,
LDV-ME