Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reindex via ADO

Status
Not open for further replies.

tjohnson

Programmer
May 10, 2002
4
US
Hello --

Is it possible to REINDEX a VFP 6 table using an ADO Recordset? I figured out how to PACK a table, but have not had much luck with REINDEX. Also, the FoxPro documentation indicates that PACK will rebuild the index files if one or more indexes are opened. I assume this means I have to USE the table, but I don't know how to do that through ADO either.

Thanks for the help.
 

Create a ODBC data source with the microsoft dbf VFP driver and then use that for part of your connection.

Note:

When you set up your ODBC data source you have an option to use a free table directory. Select that option and you will be able to change tables or even change directories. It will also allow you to do joins between tables.
 
db.source = "SELECT * FROM tablename " & _
"WHERE field = " & whatever & "" & _
" ORDER BY whateveryouwanttosortitby " ----------------
Joe
 
I suppose I should clarify my problem a little better. We have a VB app that has been distributed to several thousand customers. The app originally used a MS Access database, but we soon found out that Access can be slow when used on a network. So, we switched to FoxPro, which seemed to be a great improvement. However, being new to FoxPro, I was not familiar with how to properly optimize the table indexes, so now some of our customers, with large amounts of data, are seeing similar speed issues.

I have since learned how to optimize the indexes, and need to distribute an update to our customers. We can usually replace the table files (.dbf & .cdx) with new copies, but some of the tables contain data the customers do not want to lose. My plan for those tables was to replace just the .cdx files, then rebuild the indexes.

Our VB app uses ADO to connect to the FoxPro database via the Microsoft Visual FoxPro ODBC driver. I have been able to issue the FoxPro PACK command, with no problem, using the following syntax:

sSql = "PACK table"
set oRS = oConn.Execute(sSql)

I was hoping there was a similar way to issue the FoxPro REINDEX command. If not, is there any way, other than writing a FoxPro app, to rebuild the indexes on these tables?

Thanks,

Terry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top