Don K
2006-01-20 23:46:11 UTC
Hi,
I am using .NET framework 2.0 to open Foxpro DBF files. I have
successfully opened DBF files from C# using vfpoleddb driver (VFP 9.0)
and SQL SELECT statements.
The problem is that while the CDX index file is being opened as part of
the connection / command process, none of the actual indexes (ie TAGs)
within the CDX file are being selected, so when I run a select SQL
against the DBF file which has 1 million plus records it is slow
because no index is in use. I have also verified this by temporarily
deleting the CDX file and the SQL select takes the same slow time.
(Note no .IDX or .NTX or .MTX indexes involved here - the CDX index is
working fine for foxpro apps)
So its not so much a question of "cannot" set an index, rather "don't
know how" to set an index from C#.
How do I know the CDX file is being opened?
Because "SELECT TAG(1) FROM testfile.dbf", correctly returns the
first tag name in the CDX and "SELECT TAG(2) FROM testfile.dbf",
correctly returns the secong tag name. I get same data if I request
the schema indexes table, as in "oledbConn.GetSchema("INDEXES");"
Also when I execute "SELECT ORDER() FROM testfile.dbf" I get an empty
string back.
I do not want to create any new indexes, just use the perfectly good
existing ones! Does anyone know how to do "SET INDEX TO ORDER 1" in C#
using OleDbConnection and OleDbCommand objects, or some other technique
which would achieve the same end?
Don
I am using .NET framework 2.0 to open Foxpro DBF files. I have
successfully opened DBF files from C# using vfpoleddb driver (VFP 9.0)
and SQL SELECT statements.
The problem is that while the CDX index file is being opened as part of
the connection / command process, none of the actual indexes (ie TAGs)
within the CDX file are being selected, so when I run a select SQL
against the DBF file which has 1 million plus records it is slow
because no index is in use. I have also verified this by temporarily
deleting the CDX file and the SQL select takes the same slow time.
(Note no .IDX or .NTX or .MTX indexes involved here - the CDX index is
working fine for foxpro apps)
So its not so much a question of "cannot" set an index, rather "don't
know how" to set an index from C#.
How do I know the CDX file is being opened?
Because "SELECT TAG(1) FROM testfile.dbf", correctly returns the
first tag name in the CDX and "SELECT TAG(2) FROM testfile.dbf",
correctly returns the secong tag name. I get same data if I request
the schema indexes table, as in "oledbConn.GetSchema("INDEXES");"
Also when I execute "SELECT ORDER() FROM testfile.dbf" I get an empty
string back.
I do not want to create any new indexes, just use the perfectly good
existing ones! Does anyone know how to do "SET INDEX TO ORDER 1" in C#
using OleDbConnection and OleDbCommand objects, or some other technique
which would achieve the same end?
Don