469,648 Members | 1,331 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,648 developers. It's quick & easy.

index to foxpro files

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

Mar 7 '07 #1
1 2290
Hi,

"ray well" <no****@nospam.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>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);

}
Mar 7 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Steve Perry | last post: by
2 posts views Thread by NOSPAMrclark | last post: by
1 post views Thread by ray well | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.