DataTable ColumnChanging event nit firing on adaptor.Fill()

G

Guest

Hi

I am successfully filling my DataSet with data using an adaptor. Prior to
calling Fill(), I regsiter handler for the ColumnChanging event of each
DataTable in my DataSet because I want to do field level validation of each
data item.

Unfortunately, my event handler is NOT getting called! Does this mean that
DataTable events do not fire during a Fill() and that they only fire AFTER a
DataTable has been filled with data? I hope not.

By the way, if I Fill from XML my event handlers do get called as the tables
are being filled - it is only when I go to Oracel, Sql Server and Sybase
(yep, we use them all!) that the handlers do not get called.

Any help on this would be much appreciated.
 
G

Guest

Turns out this is a design feature!!!

I found the following note on MSDN

Most operations that add or delete rows do not raise the ColumnChanged and
ColumnChanging events. However, the ReadXml method does raise ColumnChanged
and ColumnChanging events, unless the XmlReadMode is set to DiffGram or is
set to Auto when the XML document being read is a DiffGram.

see http://msdn2.microsoft.com/en-us/library/w9y9a401(VS.80).aspx
 

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