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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:57:33+00:00 2026-06-12T11:57:33+00:00

I am getting values from different tables i var type and I want to

  • 0

I am getting values from different tables i var type and I want to return them. What should be the return type of the function:-

  public void getlist()
    {
        try
        {
            using (ShowDataToClientDataContext c = new ShowDataToClientDataContext())
            {
               var recList = (from record in c.GetTable<T_RECORDSHOW>()
                              where record.RecordStatus.Equals(RecordStatus.Active)
                              select new
                              {
                                  Student = (from stu in c.T_STUDENTSHOWs
                                             where stu.Id.Equals(record.StudentId)
                                             select stu.Name).Single().ToString(),
                                  Trade = (from t in c.T_TRADESHOWs
                                           where t.Id.Equals(record.TradeId)
                                           select t.Name).Single().ToString(),
                                  SessionId = (from s in c.T_SESSIONSHOWs
                                               where s.Id.Equals(record.SessionId)
                                               select s.Name).Single().ToString(),
                                  Month = record.Month.ToString(),
                                  Attendance = record.Attendance.ToString(),

                              }).ToList();
               return recList;
            }

        }
        catch
        {

        }
    }

anybody there to help me?

  • 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-12T11:57:34+00:00Added an answer on June 12, 2026 at 11:57 am

    var isn’t a type in itself. It just asks the compiler to infer the type of the local variable.

    Now in your case, the type is a List<T> where the T is an anonymous type. If you want to be able to use the properties within the elements of the list from other code, you’ll need to either do so dynamically (ick) or turn the anonymous type into a full, named type. Anonymous types are really only designed to be used from the methods where the objects are created. You can then return a List<DenormalizedRecord> or whatever.

    Also note that your query would be much simpler if you’d just use joins:

     from record in c.GetTable<T_RECORDSHOW>()
     where record.RecordStatus.Equals(RecordStatus.Active)
     join student in c.T_STUDENTSHOWs on record.StudentId equals student.Id
     join trade in c.T_TRADESHOWs on record.TradeId equals trade.Id
     join session in c.T_SESSIONSHOWs on record.SessionId equals session.Id
     select new DenormalizedRecord {
         Student = student.Name,
         Trade = trade.Name,
         SessionId = session.Name, // Confusing property name, by the way
         Month = record.Month.ToString(), // Why the ToString()?
         Attendance = record.Attendance.ToString() // What the ToString()?
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a method for getting values from database. public virtual List<TEntity> GetValues( int?
Im getting 2 values from a table and I'd like to compare them. If
I am getting the values from database as an array <?php foreach($this->getlist as $value){
I'm still searching solution for getting values from dynamic created object. Follwing code generates
In the below program,i am not getting values from printf . #include<stdio.h> int main()
I have a doubt in listview android. I am getting 3 dynamic values from
I'm getting odd behavior (it generates only missing values) from the following loop -
So, I'm getting a bunch of string values from a JSON object and then
So I've been getting some mysterious uninitialized values message from valgrind and it's been
Getting error while inserting values into database (SQL Server 2008) Implicit conversion from data

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.