Hi all,
Using studio 2008
Vista
MSSQL 2005
I am wanting to achive something like:
select * from mytable where mycolumn in (1,2,3)
How does one perform a select in, with linq
Thanks
Robert 2 10388
Robert Bravery <me@u.comwrote:
Using studio 2008
Vista
MSSQL 2005
I am wanting to achive something like:
select * from mytable where mycolumn in (1,2,3)
How does one perform a select in, with linq
Try Contains:
int[] options = {1, 2, 3};
var query = from row in mytable
where options.Contains(row.MyColumn)
select row;
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
Thanks jon, that helped a lot. It worked
Robert
"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:MP*********************@msnews.microsoft.com. ..
Robert Bravery <me@u.comwrote:
>Using studio 2008 Vista MSSQL 2005
I am wanting to achive something like: select * from mytable where mycolumn in (1,2,3)
How does one perform a select in, with linq
Try Contains:
int[] options = {1, 2, 3};
var query = from row in mytable
where options.Contains(row.MyColumn)
select row;
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: shapper |
last post by:
Hello,
I have 3 SQL tables:
TagId, TagText
PostId, TagId, ...
FileId, TagId, ...
I need to, using LINQ, select all records in Tags, including the
columns TagId and TagText, but adding...
|
by: BeSharp |
last post by:
I recently stumbled across a pretty interesting LINQ to SQL question and
wonder, whether anybody might have an answer. (I'm doing quite some
increasing LINQ evangelism down here in Germany.).
...
|
by: Andy B |
last post by:
Just wondering why linq is more useful than datasets? The stuff I do doesn't
seem to be too complicated to use linq with it. If I did use linq with it
now, I would be doing almost the exact same...
|
by: shapper |
last post by:
Hello,
I have two Lists:
A = {ID, Name} = { (Null, John), (Null, Mary), (Null, Andrew), (Null,
Peter) }
B = {ID, Name} = { (1, John), (2, Robert), (3, Angela), (4, Andrew) }
I want to...
|
by: shapper |
last post by:
Hello,
I have the following LINQ:
List<Tagtags = (from t in
database.Tags
select t).ToList();
I need to restrict my results and for that I have two parameters:
StartWidth and N
|
by: Plissskin |
last post by:
I need to create an "ad-hoc" filtering page in a web app we are
building. The page would display a number of drop down lists, text
boxes, and radio lists and allow the user to select (enter) some...
|
by: thj |
last post by:
Hi,
I was wondering what you guys are using and why?
LINQ to SQL or NHibernate?
Thanks in advance,
Tommy
|
by: shapper |
last post by:
Hello,
Is it possible to multiply all Prices in a List<Productby 1.1 using
Linq?
Product has a property named Price.
Thanks,
Miguel
|
by: hrishy |
last post by:
Hi
Will LINQ be ported to Python ?
regards
Hrishy
|
by: shapper |
last post by:
Hello,
I have the following Linq query:
List<PostsTaginsert = (from t in
(from t in database.Tags
join p in paper.Tags on t.Name
equals p.Name
select t).ToList()
select new PostsTag {
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |