The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Cloning a record for an INSERT

Last post 01-27-2007, 6:57 PM by ESAdmin. 0 replies.
Sort Posts: Previous Next
  •  01-27-2007, 6:57 PM 17

    Cloning a record for an INSERT

    This will turn the employee record into a newly saved record in the database with its own id, in this case the id is an identity column.

    Code:
    Employees e = new Employees(); 
    e.LoadByPrimaryKey(1);
    e.MarkAllColumnsAsDirty(DataRowState.Added);
    e.Save();


    The MarkAllColumnsAsDirty method first sets the row state to DataRowState.Added which indicates that this is a new record, then it marks all of the columns as dirty, finally, a call to Save() creates our new record.
     

View as RSS news feed in XML