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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:03:21+00:00 2026-06-12T13:03:21+00:00

I get data from a DBF file and put it in a DataTable, the

  • 0

I get data from a DBF file and put it in a DataTable, the thing is I just want to get the distinct data, for example:

Column1
  a
  b
  c
  b
  a

And the DataTable should be populated just with:

Column1
  a
  b
  c

Is there any way to make this happen, or get it around??

            connDBF.Open();
            string jobData1 = "SELECT * FROM HREQDETM.DBF";

            OdbcCommand cmd1 = new OdbcCommand();
            cmd1.CommandText = (jobData1);

            OdbcDataAdapter dbAdapter1 = new OdbcDataAdapter(jobData1, connDBF);

            DataSet dtSet1 = new DataSet();
            dbAdapter1.Fill(dtSet1);


            DataTable dbTable1 = dtSet1.Tables[0];

The thing is, I’m doing a migration and the data is in DBF files, I want something quick because I’m going to run the script in my computer and send the data through a VPN in SQL statement

  • 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-12T13:03:27+00:00Added an answer on June 12, 2026 at 1:03 pm

    Just add DISTINCT to your query

    string jobData1 = "SELECT DISTINCT Column1 FROM HREQDETM.DBF";
    

    If you want distinct values for Column1 but still the rest of the columns in the table you have to decide which data to get when two or more values are group together as one for Column1.

    Example

    Column1  Column2
      a         1
      b         1
      c         1
      b         2
      a         2
    

    So when the duplicates for a is removed what do you want to display in column2: 1 or 2?
    You can write:

    SELECT
       Column1,
       MIN(Column2) --To get 1 Or MAX(Column2) to get 2
    FROM 
      HREQDETM.DBF
    GROUP BY 
      Column1
    

    I would recommend reading some more about Group by and aggregates

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

Sidebar

Related Questions

I am trying to get data from xml file and then filter using datatable.Select()
I want to get data from database in my android table view . Should
I get data from a UTF-8 encoded XML file, and I want to display
I am using OLEDB to Update data in .dbf database from c#. I get
I get data from a 3rd party API that just gives me back a
I want to get data from mysql database with the help of DataImportHandler so
I need to get data from xml file <?xml version=1.0?> <xml> <User> <Agent> <id>cr4523</id>
I want to get data from table in MySQL and to show it in
I get data from a database in YYYY-mm-dd format, but I want to show
I want to get data from an Excel worksheet in an SQL-like mode. Meaning,

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.