Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3632128
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:29:10+00:00 2026-05-19T00:29:10+00:00

I want to pull data from table Province_Notifiers and also fetch all corresponding items

  • 0

I want to pull data from table “Province_Notifiers” and also fetch all corresponding items from table “Province_Notifier_Datas”. The table “Province_Notifier” has a guid to identify it (PK), table “Province_Notifier_Datas” has a column called BelongsToProvinceID witch is a foreign key to the “Province_Notifier” tables guid.

I tried something like this:

var records = from data in ctx.Province_Notifiers
              where DateTime.Now >= data.SendTime && data.Sent == false
              join data2 in ctx.Province_Notifier_Datas on data.Province_ID equals data2.BelongsToProvince_ID
              select new Province_Notifier
              {
                  Email = data.Email,
                  Province_ID = data.Province_ID,
                  ProvinceName = data.ProvinceName,
                  Sent = data.Sent,
                  UserName = data.UserName,
                  User_ID = data.User_ID,
                  Province_Notifier_Datas = (new List<Province_Notifier_Data>().AddRange(data2))
              };

This line is not working and i am trying to figure out how topull the data from table2 into that Province_Notifier_Datas variable.

Province_Notifier_Datas = (new List<Province_Notifier_Data>().AddRange(data2))

I can add a record easily by adding the second table row into the Province_Notifier_Datas but i can’t fetch it back.

Province_Notifier dbNotifier = new Province_Notifier();
// set some values for dbNotifier
dbNotifier.Province_Notifier_Datas.Add(
          new Province_Notifier_Data
          {
              BelongsToProvince_ID = userInput.Value.ProvinceId,
              EventText = GenerateNotificationDetail(notifierDetail)
          });

This works and inserts the data correctly into both tables.

Edit:

These error messages is thrown:

Cannot convert from ‘Province_Notifier_Data’ to ‘System.Collections.Generic.IEnumerable’

If i look in Visual Studio, the variable “Province_Notifier_Datas” is of type System.Data.Linq.EntitySet

The best overloaded method match for ‘System.Collections.Generic.List.AddRange(System.Collections.Generic.IEnumerable)’ has some invalid arguments

Edit:

var records = from data in ctx.Province_Notifiers
              where DateTime.Now >= data.SendTime && data.Sent == false        
              join data2 in ctx.Province_Notifier_Datas on data.Province_ID equals data2.BelongsToProvince_ID
              into data2list
              select new Province_Notifier
              {
                  Email = data.Email,
                  Province_ID = data.Province_ID,
                  ProvinceName = data.ProvinceName,
                  Sent = data.Sent,
                  UserName = data.UserName,
                  User_ID = data.User_ID,
                  Province_Notifier_Datas = new EntitySet<Province_Notifier_Data>().AddRange(data2List)
              };

Error 3 The name ‘data2List’ does not exist in the current context.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T00:29:10+00:00Added an answer on May 19, 2026 at 12:29 am

    data2 represents a single object of type Province_Notifier_Data, not an enumeration (therefore the exception). Try to insert an into clause into your query:

    var records = from data in ctx.Province_Notifiers
                  where DateTime.Now >= data.SendTime && data.Sent == false
                  join data2 in ctx.Province_Notifier_Datas
                      on data.Province_ID equals data2.BelongsToProvince_ID
                  into data2List
                  select new Province_Notifier
                  {
                      Email = data.Email,
                      Province_ID = data.Province_ID,
                      ProvinceName = data.ProvinceName,
                      Sent = data.Sent,
                      UserName = data.UserName,
                      User_ID = data.User_ID,
                      Province_Notifier_Datas = data2List
                  };
    

    If Province_Notifier_Datas is of type EntitySet<T> you could try the following: Define an extension method (idea from here):

    public static class Extensions
    {
        public static EntitySet<T> ToEntitySet<T>(this IEnumerable<T> source)
            where T : class
        {
            var entitySet = new EntitySet<T>();
            entitySet.AddRange(source);
            return entitySet;
        }
    }
    

    And then replace the last line by:

    Province_Notifier_Datas = data2List.ToEntitySet()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to pull data from an source destination. How can I insert rows
I am trying to pull data from a table I have imported into my
I want to pull data from three tables, but if the data doesn't exist
Just wondering which is best here. I want to output data from a table
I am looking for an efficient way to pull the data I want out
I am trying to pull data from SQL, and then write it to a
I need to pull data from two tables: Neptune_FN_Analysis and Neptune_prem There will be
I have a timezone aware timestamptz field in PostgreSQL. When I pull data from
I am trying to modify a stored procedure I wrote to pull data from
I'm working on an ssis package to fix some data from a table. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.