How Do I setup a RowChangedEvent in a Typed DataSet

  • Thread starter Thread starter Devon-S
  • Start date Start date
D

Devon-S

Greetings,

I have a strongly typed dataset and when I write the identity column to the
database, I set it and retrieve it. This works fine.

Now I want an event to trigger for each record that is set and retrieved
from the DataSet to update the children of the DataSet with the new identity
column.

The DataSet Created two Classes for the Products Class called

ProductsRowChangeEvent - and -
ProductsRowChangeEventHandler

which will probably do the trick if I knew how to use them, or could find
some documentation on these two Classes.

Any thoughts would be greatly appreciated.


-Devon
 
It seems to me I discussed this in my article posted to Developer.Com. See
the article on using the TableAdapter for Hierarchical ops.

--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker’s Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________
 
William,

I just read Hierarchical TableAdapter 301 and it wasn't in there. Was there
another reference?

Devon
 
Devon,

Just use the DataSet has changes, although that is even not needed, there
will no rows be updated by a "DBDataAdapter.Update" as long as a row has no
changed rowstate.

Cor
 
Greg,

Thanks. I also figured out how to wire up the typed dataSet Event. It is one
of those things that once ya do it, it is very simple.

TypedDataSet.DataTable.DataTableRowChanged += <at this point VS2005 bring up
the right thing and suggests you hit Tab> so you get for Products DataTable
in NorthWind DS

NorthWind.Products.ProductsRowChanged += ProductsRowChangedEventHandler(
<and at this point Visual Studio asks if you want the method made for you>)

Which then you have

NorthWind.Products.ProductsRowChanged +=
ProductsRowChangedEventHandler(Products_ProductsRowChanged)

void Products_ProductsRowChanged(object sender ProductsRowChangedEvent e)
{

}

Then I tested the code it works just like you would think. When something
changes it passes the changes to this event and you can access the row with
e.Row.

Thanks for leading me towards it...

Devon
 
Glad I could point in the right direction. I assume this is either in
library code or your page events. If you ever directly alter the DataSet
(not necessary in 2.0 and later as you can extend in your own class, make
sure you document, as someone might go and regen the DataSet if there is a
schema change and blow your required bits out of the water.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
| Think outside the box!
|
*************************************************
 
Back
Top