By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,425 Members | 1,371 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,425 IT Pros & Developers. It's quick & easy.

LINQ. Insert. How can I do this?

P: n/a

I have 3 tables:

Files FileID, Url, ...
Tags TagID, Name, ...
FilesTags FileID, TagID, ...

FilesTags is used to associate tags to each file.

Before I update a file I have the following data:
1. File Data
2. List of File Tags (TagsList)

I need to:
1. Update File Data (This is done)
2. Update File Tags ...

I am having problems updating the file tags using LINQ.

The sequence I am trying to create is:

FOR each Tag in TagsList {

Exists = Find Tag in Tags table given its name

IF Not Exists Create Tag in Tags table using the Name

Use found or created Tag ID and add record to FilesTags with
FileID and TagID

How can I translate this to LINQ?


Jun 27 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.