Subject Read changes made in update triggers
Author paulpager
Hallo everybody, i try to do something with firebird & .NET, and I'm stuck on this problem.

I'm trying to explain as simple as possible, you should only need a database table, a trigger and little bits of code to understand my wish.


The table:

A table with this colums:
tabNodeLang
[PK] IDNode, INTEGER
Displaytext, varchar(50)
Changes, Timestap

A trigger:
(it sets the current Time (from Server) on every update

CREATE TRIGGER TABNODELANG_TIMESTAMP FOR TABNODELANG
ACTIVE BEFORE INSERT OR UPDATE
POSITION 0
AS

BEGIN
/* Trigger body */
NEW.Changes = CURRENT_TIMESTAMP;
END;

The code:

The form is quite simple, it has 2 buttons, button3 loads the data, button4 saves the data, and a Datagrid (dataGrid1) shows & edits the data.


This code loads data from the Database

private void button3_Click(object sender, RoutedEventArgs e)
{
FbDataAdapter da = new FbDataAdapter("select IDNODE, DISPLAYTEXT, CHANGES from tabnodelang", connection);

ds = new DataSet();
da.Fill(ds, "tabnodelang");
dt = ds.Tables["tabnodelang"];

this.dataGrid1.AutoGenerateColumns = true;
this.dataGrid1.ItemsSource = dt.DefaultView ;
this.dataGrid1.DataContext = dt;
}


This code saves the changed data

private void button4_Click(object sender, RoutedEventArgs e)
{
FbDataAdapter da = new FbDataAdapter("select * from tabnodelang", connection);

DataTable dt = ds.Tables["tabnodelang"];
FbCommandBuilder fbc = new FbCommandBuilder(da);
int i;
da.UpdateCommand = fbc.GetUpdateCommand();
i=da.Update(dt);
label1.Content = i + " rows updatet";
}


The problem:
When I change data in the grid and press the save button (=button4_Click), the data is saved correctly, but I don't see the new timestamp in the "changes" column which is set in the trigger.

What I want:)
When I save data with da.Update(dt), the new timestamps should be read back into the dataset, and shown in the Datagrid.

Is this possible, can someone help me?

thanks a lot,
I'm both a firebird and .net novice (poor me)

I' using firebird 2.5.1.26351 (32 bit) on Windows 7 (64 bit) and Visualstudio 2010