e.action on rowchanged event not agreeing with dataTable.select(dataviewRowState.added)

A

astro

I am trapping the rowchanged event on a table. I have the following code:

If e.Action = DataRowAction.Add Then

ds.Merge(CType(sender, DataTable).Select("", "",
System.Data.DataViewRowState.Added))


The funny thing is - the merge operation captures No rows.

This appears to be a big contradiction........

Any idea why this is happening?
 
A

astro

I've googled this some more and discovered it is a bug in .net 1.1 (fixed in
2.0)

I've tried a work-around to force the insert (listed on a google post):

ds.Tables(e.Row.Table.TableName).Rows.Add(e.Row.ItemArray)

But this yeilds 0 rows in the ds.

If i look at the e.row.itemArray in the command window - I get a row
populated with expected values:

? e.Row.ItemArray
{Length=3}
(0): {System.Guid}
(1): {System.Guid}
(2): #1/1/2006#

But when I run the code to add the row to the DS in the immediate window I
get the following:

ds.Tables(e.Row.Table.TableName).Rows.Add(e.Row.ItemArray)
Referenced object has a value of 'Nothing'.

Please note that the 'ds' is declared as follows: "Dim ds as new dataset"

Is there a solution to this? Do I build a custom datarow by hand and pass
it to my ds? Does everybody just avoid using the rowchanged event for
updating the backend in ADO.NET 1.1 ?.........????
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top