What is the difference between Insert and Database.Insert ?
Ans:
Actually both are same, DML statements.
Only difference we can see while processing the Bulk Data.
Ex: 5 records are processing for contact insert and LastName field is required for insertion,
3 have all required details and 2 record doesn't have.
Ex: All record added to list "lstContact"
In Database we can see the 3 inserted records.
Ans:
Actually both are same, DML statements.
Only difference we can see while processing the Bulk Data.
Ex: 5 records are processing for contact insert and LastName field is required for insertion,
3 have all required details and 2 record doesn't have.
Ex: All record added to list "lstContact"
Insert lstContact:
It will not process any records,It rollbacks above 3 records also because of error thrown in 4th recordDatabase.Insert(lstContact,false) :
It process all the 3 records and excludes 2 records.Partial DML operation is performed.In Database we can see the 3 inserted records.
No comments:
Post a Comment