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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:34:29+00:00 2026-06-04T03:34:29+00:00

How to select all fields from datatable? ex.: var common = from c in

  • 0

How to select all fields from datatable? ex.:

var common = from c in dt1.AsEnumerable()
             join x in dt2.AsEnumerable() on c.Field<int>("ID") equals
             x.Field<int>("ID")
             select
             new object[]
             {
                 c["Col1"], x["NameCol1"], x["NameCol2"], x["NameCol3"], x["NameCol4"]

             };

How to select all fields for x? (and if x has 20 colums I do not want to write the name for all the fields)

  • 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-04T03:34:30+00:00Added an answer on June 4, 2026 at 3:34 am

    Maybe this helps:

            var customers = new DataTable();
            customers.Columns.Add("ID", typeof(int));
            customers.Columns.Add("Name");
    
            customers.Rows.Add(1, "Tom");
            customers.Rows.Add(2, "Dick");
            customers.Rows.Add(3, "Harry");
    
            var purchases = new DataTable();
            purchases.Columns.Add("ID");
            purchases.Columns.Add("Description");
            purchases.Columns.Add("PurchaseID", typeof(int));
    
            purchases.Rows.Add(1, "Bike", 1);
            purchases.Rows.Add(2, "Holiday", 1);
            purchases.Rows.Add(3, "Bike", 2);
            purchases.Rows.Add(4, "Car", 3);
    
            var query = customers.AsEnumerable().Join(purchases.AsEnumerable(),
                                        cust => cust.Field<int>("ID"),
                                        purch => purch.Field<int>("PurchaseID"),
                                        (cust, purch) =>
                                        {
                                            var res = new List<object>();
                                            res.AddRange(cust.ItemArray);
                                            res.AddRange(purch.ItemArray);
                                            return res.ToArray();
                                        }
                                        );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to select all columns from tables in join using linq Sql: select CTRL_RUN_JOB.*,
I was wondering if it's faster to select all fields from a table like:
what i need is to be albe to select all the fields information from
(SELECT field1 FROM Table1) UNION (SELECT field1 FROM Table2); This gets all rows from
How do you select all fields of two joined tables, without having conflicts with
I'd like to select all rows from one table which match one or more
I want to select all categories from a webservice. The webservice does not have
I need to select all columns from two tables, but need to be able
how to select all the data from many tables? i try `SELECT * FROM
I want to select all fields of several table and fetch result separate but

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.