.net - DataTable.Select using the IN operator -
I have never found a great way to do this, so I'm wondering what other developers like (For performance, readability, etc.).
Is there a way to use the selection operator in the datatable? The selection () function, based on the results of a query, on any other data store. For example, in SQL Server, the syntax would be:
Select some values from TableVALUE where myfield IN (select some fields from some fields, where some code = some filivariable)
< / Pre>I know that in terms of coding, this is a very simple query to do against DB, but it is being done in an app, where it does this by doing hundreds of thousands on a server Calls are due to the number of calculations included. I have given it time, and better to get all the data at once and use datatelle. Selection () or DataTable.Compute () To get the results I needed
I open anything from LINQ to datasets etc. What I really need to do, there are many trips to the server.
db Select t1.SomeValue from T1 in Table1 (where DB in T2. Table2 where t2.SomeColumn = Select few filters, T2.SomeField.) (T. 1.Mifield);
If this is too messy for you:
var lessons = T2 to DB. Select Table2 where t2.SomeColumn = SomeFilterVariable t2.SomeField; Var query = db.Table1 from where subQ.Contains (t1.MyField) select t1.SomeValue;
The cool thing here is the work of LINQ, which is & amp; Execute only one SQL statement, basically similar to the SQL you have posted.
Comments
Post a Comment