How Do I setup a RowChangedEvent in a Typed DataSet

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
 
W

William Vaughn

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)
____________________________________________________________________________________________
 
D

Devon-S

William,

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

Devon
 
C

Cor Ligthert[MVP]

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
 
D

Devon-S

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
 
C

Cowboy \(Gregory A. Beamer\)

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!
|
*************************************************
 

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