Hello,
I have a list named Form which is a List(Of Tag) where Tag is an
object with two properties: ID and Name.
I want to define a variable named Check that:
1. Is True if all Tags in Form are found in database.Tags given each
Tag Name
2. Is False if there is at least one tag in Form that, given its name,
is not present in Database.Tags.
How can I do this?
Thanks,
Miguel 4 1592
On Aug 22, 6:34*pm, shapper <mdmo...@gmail.comwrote:
Hello,
I have a list named Form which is a List(Of Tag) where Tag is an
object with two properties: ID and Name.
I want to define a variable named Check that:
1. Is True if all Tags in Form are found in database.Tags given each
Tag Name
2. Is False if there is at least one tag in Form that, given its name,
is not present in Database.Tags.
How can I do this?
Thanks,
Miguel
I have the following:
bool verify = (from t in database.Tags
join f in Form on t.Name equals f.Name
select t).Any();
But, if I am not wrong, this checks if Any of the tags in Form exist
in database.
But I want to check if all exist.
Does anyone knows what should I do?
Thanks,
Miguel
On Fri, 22 Aug 2008 10:52:31 -0700, shapper <md*****@gmail.comwrote:
I have the following:
bool verify = (from t in database.Tags
join f in Form on t.Name equals f.Name
select t).Any();
But, if I am not wrong, this checks if Any of the tags in Form exist
in database.
But I want to check if all exist.
Does anyone knows what should I do?
It seems to me that you could either:
-- reverse the join so that the result includes only those Tags in
your Form that _don't_ appear in the database (a non-empty result
indicates your "false" condition)
-- compare the Count of the results to the Count of the Form; if they
are equal, then all Tags matched, otherwise at least one didn't
Pete
On Aug 22, 7:05*pm, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
On Fri, 22 Aug 2008 10:52:31 -0700, shapper <mdmo...@gmail.comwrote:
I have the following:
* * * bool verify = (from t in database.Tags
* * * * * * * * * * * * *join f in Form on t.Name equals f.Name
* * * * * * * * * * * * *select t).Any();
But, if I am not wrong, this checks if Any of the tags in Form exist
in database.
But I want to check if all exist.
Does anyone knows what should I do?
It seems to me that you could either:
* * *-- reverse the join so that the result includes only those Tags in *
your Form that _don't_ appear in the database (a non-empty result *
indicates your "false" condition)
* * *-- compare the Count of the results to the Count of the Form; if they *
are equal, then all Tags matched, otherwise at least one didn't
Pete
I am a little bit confuse. You mean:
bool verify = (from l in list
join t in database.Tags on l.Name equals t.Name
select l).Any();
It is not working.
Am I doing something wrong?
Thanks,
Miguel
On Fri, 22 Aug 2008 14:05:10 -0700, shapper <md*****@gmail.comwrote:
I am a little bit confuse. You mean:
bool verify = (from l in list
join t in database.Tags on l.Name equals t.Name
select l).Any();
Sorry, no...that's not what I mean. I didn't intend for you to take the
word "reverse" so literally. I just mean to do a different query that
excludes matching records instead of includes them. I'm not a database
expert, and "join" is probably technically the wrong word to use. You
probably wouldn't even use the "join" keyword in the LINQ query. But I
don't know the jargon, so I didn't have any better way to describe it.
That said, the second option should work fine, I'd think.
Pete This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: shapper |
last post by:
Hello,
I created 3 few tables that have Many to Many relationships:
Posts (PostId PK)
Files (FileId PK)
PostsTags (PostId PK, TagId PK)
FilesTags (FileId PK, TagId PK)
|
by: shapper |
last post by:
Hello,
I have 2 tables:
Aid, Aname ...
Bid, Aid, Bname ...
I need to get the records in B given a Bname and a Aname. I think I
should use Inner Join.
I wrote the following code:
|
by: =?Utf-8?B?VG9tIEJvbWJhZGls?= |
last post by:
Question: Can an outer non-equijoin be simulated using LINQ?
It's quite unfortunate that LINQ doesn't support literal joins based on
anything other than equality. I know that this the most common...
|
by: Alcides |
last post by:
Hello all,
I learn about LINQ here in this forum. I been a VB.NET programmer for
quite a while and we are using an internal solution for SQL access. I
have some experience with C# and I started...
|
by: shapper |
last post by:
Hello,
I am used to SQL but I am starting to use LINQ.
How can I create Left, Right and Inner joins in LINQ? How to
distinguish the different joins?
Here is a great SQL example:...
| |
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 3 tables: Posts, Tags and PostsTags.
PostsTags relates Posts with Tags and has 3 fields: PostID and TagID.
I have all the relationships between tables well defined!
I have...
|
by: Dan Tallent |
last post by:
I have a query which I would like to convert to LINQ. I am having
problems finding good examples or references that cover more complex
queries.
Here is the SQL command I would like to rewrite...
|
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: Jay Douglas |
last post by:
Hello,
I've found some posts on creating dynamic WHERE clauses in LINQ to SQL using
predicate builders and extending lamda expressions. One issue with these
posts is all the examples only use a...
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |