Home Updating a row Deleting a row

From .NET code

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


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

    dataInterface.AuditedUpdate(UserID, "tblCompany", fields, CompanyID);


From SQL CLR

Use CLR_SqlRetroview_BeforeUpdate, 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. Also note that for the third parameter, any valid SQL criteria can be used instead of the primary key of the update row. This way, multiple rows can be updated at once.

    
    EXEC dbo.CLR_SqlRetroview_BeforeUpdate 'tblCompany', 
        'CompanyName,Phone,TimeZoneID', '12', 
        @UserID
    
    --OR
    
    EXEC dbo.CLR_SqlRetroview_BeforeUpdate 'tblCompany', 
        'CompanyName,Phone,TimeZoneID', 'CompanyID=12', 
        @UserID
        
    
    UPDATE tblCompany SET
        CompanyName='CompanyName',
        Phone='(123) 456-7890',
        TimeZoneID=3
    WHERE
        CompanyID=12