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

  • Home
  • SEARCH
  • 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 8400935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:40:44+00:00 2026-06-09T21:40:44+00:00

how can I read from entity Framework? I use this to insert items: public

  • 0

how can I read from entity Framework?

I use this to insert items:

    public void Insert()
    {
        using (HistoryContainer db = new HistoryContainer())
        {
            HistoryData e = new HistoryData();
            e.MP = IpAddress;
            e.Number = OtherPartyNumber;
            e.DateTimeStart = DateTime.Now;
            e.Duration = duration;
            e.TypeDescription = type;
            e.text = e.text;
            db.AddToHistoryDataSet(e);
            db.SaveChanges();
        }
    }

I tried this to read them:

    public virtual IEnumerable<HistoryContainer> ReadFirst()
    {
        using (HistoryContainer x = new HistoryContainer())
        {
            foreach (var item in HistoryData.where(b => b.MP == IpAddress))
            {
                _history.Add(new HistoryItem(item));
            } 
        }
    }

But it didn’t work. What’s wrong?
Thanks.

  • 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-06-09T21:40:45+00:00Added an answer on June 9, 2026 at 9:40 pm
       public virtual HistoryData ReadFirst()
        {
            using (HistoryContainer db = new HistoryContainer())
            {
                return db.HistoryData.Where(x => x.MP == IpAddress).FirstOrDefault();
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I read from and write to my Galaxy Nexus phone, using MTP
I found that you can't read from some sites using Python's urllib2(or urllib). An
Is there way that I can read the file from remote server using fopen
I'm pretty new to MVC 2 using the Entity Framework. I have two tables
Using the .Net framework, I need to read XML entity text as raw string
I have this ASP.NET app, in which I use Entity Framework to connect to
I am using entity framework to insert details into the database where I have
I'm using Entity Framework and MVC3, and my problem is that I can't scaffold
I have a SQL Server database which I can read from, is there a
Okay, so I want to have a generic method that can read data from

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.