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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:37:34+00:00 2026-05-23T06:37:34+00:00

Being new to working with Data, I hope I’m asking this properly. How can

  • 0

Being new to working with Data, I hope I’m asking this properly. How can I select what columns come in from a DataSet into a DataTable? I know I can fill a DataTable by using…

DataTable table = dataSet1.Tables[0];

but this brings in all the columns. How can I fill a DataTable with only certain columns?

I’m using .NET 3.5, C#, and a SQL CE 3.5 single table database.

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-05-23T06:37:34+00:00Added an answer on May 23, 2026 at 6:37 am
        // Assumes that connection is a valid SqlConnection object.
    
    string queryString = "SELECT CustomerID, CompanyName FROM dbo.Customers";
    SqlDataAdapter adapter = new SqlDataAdapter(queryString, connection);
    
    DataSet customers = new DataSet();
    adapter.Fill(customers, "Customers");
    
    DataTable table = customers.Tables[0];
    

    Instead of “CustomerID, CompanyName” you can put the columns you want to select.

    For further learning check this MSDN link.

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

Sidebar

Related Questions

I can't get both INNER JOINS working. Data is being displayed when I only
being new to WPF this is a complex problem for me. What i want
I figured this would be simple, but being new to SSRS I'm not sure.
I have some library of classes, working with my data, which is being read
Being a noob ... I can't quite figure out what isn't working here ....
Back again this time working with data providers. Well i been doing a bit
I have NSKeyedArchiver and NSCoder data being persisted (as .txt files) and working great.
I'm working with Core Data for the first time and this has me stumped.
In a project I'm working on, I'm requesting data from an external API in
I'm working on an asp.net-mvc application. The linq data context is being passed into

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.