index to foxpro files

  • Thread starter Thread starter ray well
  • Start date Start date
R

ray well

i need to access a legacy database that uses dBase files running under
foxpro for read only purposes, within net 2.0, ado 2.0, and sql
statements. i have no problem getting the info i need, but it is very slow.
i'm not using any indexes which the databases have, *.idx files, i don't
know how to access them.

the connection string i use is:

Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=dBASE
IV;User ID=Admin;Password=;Data Source=""M:\Names\""

M is a network drive, Names is the folder name where the databases are.

how do i make my data access go thru the indexes, do i change the connection
string, or the sql statement, or something else? i would appreciate a code
snippet.

thanks



ray
 
Hi,

ray well said:
i need to access a legacy database that uses dBase files running under
foxpro for read only purposes, within net 2.0, ado 2.0, and sql
statements. i have no problem getting the info i need, but it is very
slow.
i'm not using any indexes which the databases have, *.idx files, i don't
know how to access them.

the connection string i use is:

Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=dBASE
IV;User ID=Admin;Password=;Data Source=""M:\Names\""


This is the code I use to read from a foxpro table , SourceFile is the path
to the table you want. TableName is a method that return the name of the
table.

string connString;
OleDbConnection conn;
OleDbDataAdapter adapter;

connString = "Provider=VFPOLEDB.1;Data Source="+ sourceFile + ";";
conn = new OleDbConnection( connString);

adapter = new OleDbDataAdapter( "select * from " + TableName(sourceFile),
conn);
adapter.Fill( data, tablename);



string TableName( string sourceFile)
{
int lastIndex = sourceFile.LastIndexOf(@"\") +1;
return sourceFile.Substring( lastIndex, sourceFile.Length - lastIndex-4);

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top