Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I need to SubmitChanges after executing a stored procedure with Linq-To-Sql?

Linq-To-Sql enables calling SPs. If this SP executes an update/delete/insert, do I need to SubmitChanges() after it?

like image 354
Jader Dias Avatar asked Aug 03 '09 17:08

Jader Dias


People also ask

What happens when a stored procedure is compiled?

When a procedure is compiled for the first time or recompiled, the procedure's query plan is optimized for the current state of the database and its objects. If a database undergoes significant changes to its data or structure, recompiling a procedure updates and optimizes the procedure's query plan for those changes.

Can we use LINQ with stored procedure?

In LINQ to SQL, we can use stored procedures with or without parameters to get the required data from database tables. Before we start using LINQ to SQL with a stored procedure, we need to create a database with required tables and map those tables to LINQ to SQL file (. dbml).

What is the best way to execute a stored procedure in the database?

In Object Explorer, connect to an instance of the SQL Server Database Engine, expand that instance, and then expand Databases. Expand the database that you want, expand Programmability, and then expand Stored Procedures. Right-click the user-defined stored procedure that you want and select Execute Stored Procedure.


1 Answers

No you don't. The code will work. Submit changes is only concerned with modified LINQ to SQL objects and not stored procs.

like image 178
RichardOD Avatar answered Oct 18 '22 15:10

RichardOD