Re: Raising an event when a row is added by v-kevy
v-kevy
Mon Feb 23 00:07:29 CST 2004
Thanks for Wes's quick response.
Hi Bob,
Thank you for posting in the community!
First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to be notified when a row is
added to the SQL server. If there is any misunderstanding, please feel free
to let me know.
As far as I know, the SQL server trigger cannot be passsed to .NET
framework. So we have to use other ways to be aware of that. If you're
using a SqlDataAdapter to update the DataSet, we can handle the
SqlDataAdapter.RowUpdating event. In the event handler, we can check the
value of e.Row.RowState property. It stands for whether the row is going to
be inserted, updated or deleted. If the value is Added, it will be added to
the database table. So we can do something in the event handler.
However, this can only capture the insert actions that are done through the
SqlDataAdapter. If the insert is done with a SqlCommand.ExecuteNonQuery(),
I don't think we can be notified in .NET framework.
Does this answer your question? If anything is unclear, please feel free to
reply to the post.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."