Results 1 to 3 of 3

Thread: Write something to the table

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Location
    Karlsruhe, Germany
    Posts
    122

    Post

    Hi,

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

    Code:
    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

  2. #2
    Addicted Member pardede's Avatar
    Join Date
    Jan 2000
    Posts
    232

    Post

    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

  3. #3
    Member
    Join Date
    Jan 2000
    Location
    brooklyn
    Posts
    48

    Post

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width