Hi yesterday I written a small class for VB That allows you to edit, view DBase III Files in VB At the moment most of it is working you can create a new table, Add fields, delete fileds records, support most data types like Text, Numeric, Memos and more.
the only problem is deleting records, I mean I can mark a record to be deleted by adding the * to the first part of the record. But I need to remove the record all tougher. Any ideas or does any one have a small piece of code.
I looked all around the net and I can;t seem to find anything what so ever.
Thanks.
When your dreams come true.
On error resume pulling hair out.
Yes, to physically delete records from a dbase III/Fox file you must PACK it. Here's an old article - it's for VB3, but you may be able to adapt it to your needs. http://support.microsoft.com/default...b;en-us;119116
Thanks but this is not what I am looking for. I need a way to do this tho code. not using any of the MS Database controls as my project at the moment uses none of the Data Access controls. so by adding this features it's sort of defeating the object of the project.
Thanks anyway any other ideas or code.
When your dreams come true.
On error resume pulling hair out.
all dbms applications are using the same language which is SQL or the Structured Query Language.
the way to do that in sql is
delete from <Table Name> where <Field Name> like '*%';
On error goto Trap
Trap:
in case of emergency, drop the case...
****************************************
If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved" option. if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar
I don;t need to delete this record with ADO, DAO or any of the Microsoft Data Access Controls or by using SQL or any other thid party stuff, OCX, DLL Whatever.
I need to delete this record or should I say Pack the database so the recored marked with * in front of the record is removed. the remaining recoreds are kept.
ok I uploaded some of the code from my project. this has a small demo showing a sort of URL book example.
anyway You see a button on the form called delete. what this does it place a * in front of the record. and write it back to the file. But what I need is some code to find all them * and delete them records from the database file.
see the bas file for the main database stuff
Hope someone can help.
Last edited by dreamvb; Feb 28th, 2006 at 02:10 AM.
When your dreams come true.
On error resume pulling hair out.
I see that you open the file and read the data. Well that's where you could 'Pack' the database.
You can read a record and check if the first letter of the record is "*"
If it is then skip the record and go to the next one.
But then you file will remain the same. What you need to do is write a function similar to the open database but instead of loading the data into the fData array, write it to a temporary binary file. You can use your function GetRecord, PutRecord and such to do so.
You would just be putting away good records. Once the new file is created you can destroy the old file using the Kill command.