Home Inserting a row Updating a row

From .NET code

Use DataInterface.AuditedInsert, as demonstrated in the following code sample. For more information, see the documentation.


    DbObjectCollection fields = new DbObjectCollection();
    fields.AddObject("CompanyName", "NewCompanyName");
    fields.AddObject("Phone", "(123) 456-7890");
    fields.AddObject("TimeZoneID", 3);

    dataInterface.AuditedInsert(UserID, "tblCompany", fields);


From SQL CLR

Use CLR_SqlRetroview_AfterInsert, as demonstrated in the following code sample. Note that if your connection has an associated UserID (Using SetCurrentUserID) you may pass null instead, and the associated UserID will be used.

    
    INSERT INTO tblCompany 
        (CompanyName, Phone, TimeZoneID)
    VALUES
        ('NewCompanyName', '(123) 456-7890', 3)
        
    EXEC dbo.CLR_SqlRetroview_AfterInsert 'tblCompany', 
        (select scope_identity()), @UserID