Re: SQL Server Triggers and Defaults not firing on Windows form
- From: "Morgan" <nomail@xxxxxxxx>
- Date: Sat, 14 Jan 2006 23:26:03 -0500
Default constraints only apply on Insert statements, not Updates.
What does the trigger look like? Keep in note that triggers are "set" based,
in that they fire once per batch, not per-row. At best, the last row updated
will be affected by the trigger, which is why it appears to work in
Enterprise Manager, since the editor is row based.
<cefrancke@xxxxxxxxx> wrote in message
news:1137290346.397984.297500@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>I have a datagrid on a windows form with a bindingnavigator. The
> tableadapter, bindingsource and dataset are there also.
>
>
> I can browse and edit data normally.
>
>
> I had added the "click" event to the "save" button on the navigator's
> toolstrip.
>
>
> I would like to have the data for the datagrid's table(or tables if it
> is a joined recordset) to be updated to the SQL Server table that is
> being displayed in the grid.
>
>
> I used the following code...
>
>
> private void saveToolStripButton_Click(object sender, EventArgs
>
> e)
> {
> try
> {
> this.Validate();
> this.partyBindingSource.EndEdit();
> this.partyTableAdapter.Update(this.storeDataSet.Party);
>
> MessageBox.Show("Update successful");
> }
> catch (System.Exception ex)
> {
> MessageBox.Show("Update failed");
> }
> }
> }
>
>
>
> }
>
>
> I compared my changes to the SQL table and the changes were there, but
> the default values and the values on the fields set by an UPDATE
> trigger did not show up.
> BTW, the triggers and defaults work when editing in Enterprise Manager
> or Query Analyser.
>
> Any ideas?
>
>
> Also, would this be a good place to call the "Fill" method on the table
>
> adapter to refresh the records after the save/update? (assuming the
> triggers and default values work, there would be something to see when
> the refresh occurs)
>
>
> TIA
>
.
- Follow-Ups:
- Re: SQL Server Triggers and Defaults not firing on Windows form
- From: cefrancke@xxxxxxxxx
- Re: SQL Server Triggers and Defaults not firing on Windows form
- References:
- SQL Server Triggers and Defaults not firing on Windows form
- From: cefrancke@xxxxxxxxx
- SQL Server Triggers and Defaults not firing on Windows form
- Prev by Date: Re: Intelligent Directory Tree control
- Next by Date: Why I Am Not An Mvp
- Previous by thread: SQL Server Triggers and Defaults not firing on Windows form
- Next by thread: Re: SQL Server Triggers and Defaults not firing on Windows form
- Index(es):