Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
Removed fluff words; inline image; improve formatting
Source Link
Gareth Rees
  • 66.1k
  • 10
  • 139
  • 166

There is a problem I need help with your query on the data using LINQ to SQL and Entity Framework (I'm using Visual Studio 2010).

My picure hereI have three tables: http://img.tamtay.vn/files/photo2/2010/5/28/10/962/4bff3a3b_1093f58f_untitled-1.gif

I have three tables:

  1. tbl NewsDetails

    tblNewsDetails
  2. tblNewsCategories

    tblNewsCategories
  3. tblNewsInCategories

    tblNewsInCategories

(See screenphoto 1 in mythe picture below.)

Now, I want to retrieve records in the I want to retrieve records in the tblNewsDetails tabletblNewsDetails table, with condition: CategoryId=1 CategoryId=1, as the following results:

(See screenshown in photo 2 in mythe picture) below.

But NewsIDNewsID and CategoryIdCategoryId in tblNewsInCategoriestblNewsInCategories table isare two foreign key,keys. I do not see them and I do not know how to use them in yourmy code.

My code has errors:

(See screen Also, my code has errors, shown in photo 3 in mythe picture) below.

http://img.tamtay.vn/files/photo2/2010/5/28/10/962/4bff3a3b_1093f58f_untitled-1.gif

There is a problem I need help with your query on the data using LINQ to SQL and Entity Framework (I'm using Visual Studio 2010).

My picure here: http://img.tamtay.vn/files/photo2/2010/5/28/10/962/4bff3a3b_1093f58f_untitled-1.gif

I have three tables:

  1. tbl NewsDetails

  2. tblNewsCategories

  3. tblNewsInCategories

(See screen 1 in my picture)

Now, I want to retrieve records in the tblNewsDetails table, with condition: CategoryId=1, as the following results:

(See screen 2 in my picture)

But NewsID and CategoryId in tblNewsInCategories table is two foreign key, I do not see them and I do not know how to use them in your code.

My code has errors:

(See screen 3 in my picture)

There is a problem I need help with your query on the data using LINQ to SQL and Entity Framework (I'm using Visual Studio 2010).

I have three tables:

  1. tblNewsDetails
  2. tblNewsCategories
  3. tblNewsInCategories

(See photo 1 in the picture below.)

Now, I want to retrieve records in the tblNewsDetails table, with condition CategoryId=1, as shown in photo 2 in the picture below.

But NewsID and CategoryId in tblNewsInCategories table are two foreign keys. I do not see them and I do not know how to use them in my code.

Also, my code has errors, shown in photo 3 in the picture below.

http://img.tamtay.vn/files/photo2/2010/5/28/10/962/4bff3a3b_1093f58f_untitled-1.gif

Query data using LINQ to SQL and Entity Framework with foreign key? (Help me please)

There is a problem I need help with your query on the data using LINQ to SQL and Entity Framework (I'm using Visual Studio 2010).

My picure here: http://img.tamtay.vn/files/photo2/2010/5/28/10/962/4bff3a3b_1093f58f_untitled-1.gif

I have three tables:

  1. tbl NewsDetails

  2. tblNewsCategories

  3. tblNewsInCategories

(See screen 1 in my picture)

Now, I want to retrieve records in the tblNewsDetails table, with condition: CategoryId=1, as the following results:

(See screen 2 in my picture)

But NewsID and CategoryId in tblNewsInCategories table is two foreign key, I do not see them and I do not know how to use them in your code.

My code has errors:

(See screen 3 in my picture)

Please help me. Thanks!

(I am a new member, should not have the right to insert images)

Query data using LINQ to SQL and Entity Framework with foreign key? (Help me please)

There is a problem I need help with your query on the data using LINQ to SQL and Entity Framework (I'm using Visual Studio 2010).

My picure here: http://img.tamtay.vn/files/photo2/2010/5/28/10/962/4bff3a3b_1093f58f_untitled-1.gif

I have three tables:

  1. tbl NewsDetails

  2. tblNewsCategories

  3. tblNewsInCategories

(See screen 1 in my picture)

Now, I want to retrieve records in the tblNewsDetails table, with condition: CategoryId=1, as the following results:

(See screen 2 in my picture)

But NewsID and CategoryId in tblNewsInCategories table is two foreign key, I do not see them and I do not know how to use them in your code.

My code has errors:

(See screen 3 in my picture)

Please help me. Thanks!

(I am a new member, should not have the right to insert images)

Query data using LINQ to SQL and Entity Framework with foreign key?

There is a problem I need help with your query on the data using LINQ to SQL and Entity Framework (I'm using Visual Studio 2010).

My picure here: http://img.tamtay.vn/files/photo2/2010/5/28/10/962/4bff3a3b_1093f58f_untitled-1.gif

I have three tables:

  1. tbl NewsDetails

  2. tblNewsCategories

  3. tblNewsInCategories

(See screen 1 in my picture)

Now, I want to retrieve records in the tblNewsDetails table, with condition: CategoryId=1, as the following results:

(See screen 2 in my picture)

But NewsID and CategoryId in tblNewsInCategories table is two foreign key, I do not see them and I do not know how to use them in your code.

My code has errors:

(See screen 3 in my picture)

Source Link

Query data using LINQ to SQL and Entity Framework with foreign key? (Help me please)

There is a problem I need help with your query on the data using LINQ to SQL and Entity Framework (I'm using Visual Studio 2010).

My picure here: http://img.tamtay.vn/files/photo2/2010/5/28/10/962/4bff3a3b_1093f58f_untitled-1.gif

I have three tables:

  1. tbl NewsDetails

  2. tblNewsCategories

  3. tblNewsInCategories

(See screen 1 in my picture)

Now, I want to retrieve records in the tblNewsDetails table, with condition: CategoryId=1, as the following results:

(See screen 2 in my picture)

But NewsID and CategoryId in tblNewsInCategories table is two foreign key, I do not see them and I do not know how to use them in your code.

My code has errors:

(See screen 3 in my picture)

Please help me. Thanks!

(I am a new member, should not have the right to insert images)