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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:59:59+00:00 2026-06-11T17:59:59+00:00

I have a DBF file and I’m trying read it from c# code. I

  • 0

I have a DBF file and I’m trying read it from c# code. I can read files successfully without applying any conditions or applying conditions for varchar type fields.My problem is I have to filter the records from the Date field (type:date). I have tried following ways,

SELECT * FROM D:\DBFreader\file.dbf where [RDATE] between 2/16/2006 12:00:00 AM and 2/20/2006 12:00:00 AM

above gives a syntax Error: missing operator

SELECT * FROM D:\DBFreader\file.dbf where [RDATE] between '2/16/2006 12:00:00 AM' and '2/20/2006 12:00:00 AM'

above gives a data type mismatch error

SELECT * FROM D:\DBFreader\file.dbf where [RDATE] between 2/16/2006 and 2/20/2006

above does not throw any exception, but does not return any records though there are matching records.

The same things happens for the where clause as well.
What can I do to filter records from a range

I’m using following code to read it

OdbcCommand cmd = new OdbcCommand();
OdbcDataAdapter da = new OdbcDataAdapter();
DataTable dt = new DataTable();

using (OdbcConnection connection = new OdbcConnection(connstring))
{
   connection.Open();
   cmd = new OdbcCommand(@"SELECT * FROM D:\DBFreader\file.dbf where [RDATE] between 2/16/2006 12:00:00 AM and 2/20/2006 12:00:00 AM", connection);
   cmd.CommandType = CommandType.Text;

   da.SelectCommand = cmd;
   da.Fill(dt);
}
  • 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-11T18:00:01+00:00Added an answer on June 11, 2026 at 6:00 pm

    OK –

    I believe the problem is that dBase/xBase doesn’t support “between” for SQL dates

    WORKAROUND:

    @"SELECT * FROM D:\DBFreader\file.dbf where [RDATE] >= #2/16/2006 12:00:00 AM# and [RDATE] < #2/20/2006 12:00:00 AM#"

    PS:
    I know dBase syntax supports “date” literals (e.g. “2/16/2006”; I don’t know about “datetime” – plese try it and see.

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

Sidebar

Related Questions

I have a dbf file, and I can see in the view that types
I have a DBF file that is encoded as Windows-ANSI (Windows Code Page 1252).
I have to convert .DBF and .FPT files from Visual FoxPro to MySQL. Right
I have a DBF file read into a datatable and display with a datagrid
I have a DBF file on a network share that I'm trying to select
i have this code: openFileDialog1.Filter = csv files (*.dbf)|*.dbf; openFileDialog1.FilterIndex = 1; openFileDialog1.RestoreDirectory =
I have a Visual Fox Pro Database (.DCX file with associated .DBF files) that
I have a .DBF file (Well, 6 DBF files with the same structure) that
how is this solution I am using now: I have a 1MB .dbf file
I'm trying to query a DBF file using System.Data.Odbc.OdbcConnection. It works correctly when the

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.