Link to home
Start Free TrialLog in
Avatar of Chayaphad Chokasut
Chayaphad Chokasut

asked on

How to Reindex a DBF file Using VB6?

I had this question after viewing To Reindex DBF file Using VB6.
I think that the answer to above question is only demonstrate that Microsoft DAO 3.51 Object Library can index database file. However, if an index file is corrupted/damaged, the DAO won't work properly. Normally, I need to fix the damaged index file via "reindex" command using Foxpro. So, I would like to know if there is a way to do the reindex in VB6.

Best Regards
Ming
Avatar of John Tsioumpris
John Tsioumpris
Flag of Greece image

I think - since the index file is bad - the way to handle it is to first create an index file and then manipulate it if you want
Check this : http://vbcity.com/forums/t/66952.aspx
Side Note : Dbase format is OLD...maybe you should consider another approach...like transfering your data to another database engine
Avatar of Chayaphad Chokasut
Chayaphad Chokasut

ASKER

Dear John;

     Thank you for your kind solution. It's very helpful. I can now create new unique indexes by using VB6. However, if a new index is corrupt, do I have to delete it and recreate it again? or can I just directly reindex it in VB6? How could I do those?
     About new database engine, I always want to learn it. If possible, could you kindly provide some articles of new database engine that's compatible with VB6.
     Looking forward to your advices.

Best Regards
Chayaphad
If it's corrupt you can't do much...so delete it and start over.
As for DB engine. VB6 works nicely with pretty much everything..so make your pick.
I reckon that ,based on the dbase background that Access or Sqlite are your best options
Dear John

     Can I delete an index using .execute in VB6?  For example, I can create an unique index with command line
         aDatabase.Execute ("CREATE UNIQUE INDEX anIndexName ON aRecordset(aFieldName);")
     but when try to delete it with command line
         aDatabase.Execute ("DROP UNIQUE INDEX anIndexName ON aRecordset(aFieldName);")
     I got a syntax error. Please kindly help me with the correct syntax.

Best Regards
Ming
ASKER CERTIFIED SOLUTION
Avatar of Chayaphad Chokasut
Chayaphad Chokasut

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial