Lars Stenberg Lars Stenberg - 1 year ago 116
SQL Question

Upsert a list with Simple.Data

Trying to do a:

var list = new List<MyType>();
list.Add(new MyType() { PK1 = 1, PK2 = 2 });
list.Add(new MyType() { PK1 = 1, PK2 = 3 });

Nothing seems to happen, do i need to do a foreach or can i achieve this some how?

Answer Source

This will work, or any other enumeration of the result.


Although it will not generate a batch SQL query, there will be a lot of queries to the database, at least for SQL Server.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download