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 6891089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:21:56+00:00 2026-05-27T06:21:56+00:00

How can i show data from two tables in my sql database in the

  • 0

How can i show data from two tables in my sql database in the view…?

Please help.

  1. table is Profile
  2. table is Company

I want two different tables in my view to show these data from database.!

I have searched in the internet but i couldn’t find anything to solve my problem. Please help.

I have no problem with one table in my view.

public ActionResult Profiler()
{
    using (var dc = new Models.DataDataContext()) // Opretter objekt af model(Databasen)
    {
        return View(dc.Profils.OrderByDescending(a => a.Nu).ToList()); // Returner en liste med tabellets indhold
    }
}

This give me a table with data from my database in my view. But i want my second table too.

  • 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-27T06:21:57+00:00Added an answer on May 27, 2026 at 6:21 am

    What you’re looking to achieve is termed a “View Model” because the model you are sending to your views is different that the model in your database. Often times you will find that you may need to create a view for the UI that doesn’t exactly match the database.

    jgauffin shows a “DetailsModel” which combines two database entities. This is as simple as creating a class and giving it two properties, CompanyName and Username. What his code is missing is the code for the “DetailsModel” class. Instead of passing two entities you create a single entity that has all of the properties you need.

    Surjit also has a method to do such without the use of a seperate View Model class by using a Tuple.

    You will need to modify your view to accept either the Tuple or your new View Model.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

tl;dr: I need to show data from two different tables in the list view
I'm using a UITableView to show some data from an array. This array can
Can anyone show me a way of converting SQL Server data-types (varchar for example)
So my situation is this. I have two tables. A main table where data
I want to merge the results of two tables in to one. Please refer
I have a script that grabs data from a MySQL database table and creates
Is there an IDE/Tool/script/something that can show call hierarchy and/or data flow in Scala+Java
I am looking for a control which can show me selected image detail view
Can someone please tell me how to get the DB2 provider to show up
Hope someone can help - I am a novice SQL hacker (and very bad

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.