471,350 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

LINQ. Insert. How can I do this?


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
0 924

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by =?Utf-8?B?RXJpYyBGYWxza2Vu?= | last post: by
3 posts views Thread by =?Utf-8?B?UGF1bCBQcmV3ZXR0?= | last post: by
reply views Thread by bob laughland | last post: by
3 posts views Thread by bob laughland | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.