PDA

Click to See Complete Forum and Search --> : Write something to the table


RogerH
Jan 25th, 2000, 03:06 AM
Hi,

that's something the database should do! I have written an update trigger for that on SQL Server 7.0:


CREATE TRIGGER [TableUpdate] ON [tableName]
FOR UPDATE AS
UPDATE [TableName] SET
Updated = GETDATE(),
Updated_From = SUSER_SNAME()
WHERE Number IN
(SELECT Number FROM Inserted) and Deleted is Null


Number is the primary key on the table "tableName".

Roger

pardede
Jan 25th, 2000, 03:15 AM
i haven't used ADO yet but i know that in DAO you have the validate event of the data control, if ADO has the same thing, you can put code in this event that sets the text of the 'lastmodified' textbox to the sysdate, my code with DAO looks like:

private sub data1_validate()
'code for validation goes here
'... and last but not least i do this:
txtLastUpdate.Text = Now()
end sub

sanford101
Jan 25th, 2000, 11:10 AM
I have a simple table and ado data control connect to the table and a few text box connect to the ado data control. The table has a column called the lastTimeUpdated which is varchar(20)(or could be datetime type). The table has a few other regular columns like the name and age.

I would like to update the lastTimeUpdated
column ( with time and date) each time a user modify the other columns on the table.

could anybody tell me how to do that?
I tried to do that in the will_move event
of the ado event, But I got a error message.

could anybody tell me how to do that? it seems to me I can do something in the textbox
change event, but I got 20 text box, it seems to be stupid to do that. Thanks you very, very much for take your time to read it.