Scenario: You want to update an existing order's shipping address in a SQL Server database using LINQ to SQL. Which LINQ to SQL method or operation is appropriate for this situation?
- Attach
- InsertOnSubmit
- SubmitChanges
- Update
SubmitChanges method is appropriate for updating existing records in a LINQ to SQL data context. After making changes to the object properties, calling SubmitChanges persists those changes to the database. Attach is used to attach existing objects to a data context, not for updates. Update is not a direct method in LINQ to SQL for updating records. InsertOnSubmit is used for inserting new records, not for updating existing ones.
Loading...
Related Quiz
- Connection pooling in ADO.NET helps in ___________ database connections for better performance.
- Your Entity Framework application is experiencing performance issues. What are some specific aspects of mapping entities to database tables that you should review to optimize performance?
- In LINQ to SQL, which operation is used to create new records in a database table?
- The _________ property of a SqlParameter determines whether a parameter is an input or output parameter.
- How does Entity Framework facilitate LINQ queries against the database?