Skip to content

Latest commit

 

History

History
32 lines (19 loc) · 1.37 KB

File metadata and controls

32 lines (19 loc) · 1.37 KB

SQL Server INSERT

1) Basic INSERT example

In SQL, INSERT requires an ad-hoc specification of columns to insert to. There is a similar concept in C# - value tuple.

ELINQ defines an extension method - @using() that accepts a tuple. The returned object has several RowXXX() overloads to create VALUES parameters in a type-safe way.

Insert a row from an object:

We can also override properties from the passed object by passing additional parameters to the RowFrom() method. In the next example discount will be inserted with DEFAULT:

2) Insert and return inserted values


< BACK | HOME