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 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

Being new to test based development, this question has been bugging me. How much
Being relatively new to functional programming, I expend lots of energy wondering is this
In a project I'm working on, I'm requesting data from an external API in
Back again this time working with data providers. Well i been doing a bit
I'm quite new to C# (coming from a Java background) and I'm working on
Cursor cursor = resolver.query( Data.CONTENT_URI, DataQuery.PROJECTION, DataQuery.SELECTION, new String[] {String.valueOf(rawContactId)}, null); With PROJECTION being:
Being new to Cocoa, and probably not knowing all of the potential classes available
Being relatively new to the .net game, I was wondering, has anyone had any
Being really new to wx, I'm wondering if there is an IDE (especially for
Being fairly new to JavaScript, I'm unable to discern when to use each of

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.