[RESOLVED] Delete Markred Record DBase III
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.
Re: Delete Markred Record DBase III
Is there any one on this forum.
Re: Delete Markred Record DBase III
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
Re: Delete Markred Record DBase III
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.
Re: Delete Markred Record DBase III
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 '*%';
1 Attachment(s)
Re: Delete Markred Record DBase III
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.
Re: Delete Markred Record DBase III
Re: Delete Markred Record DBase III
Anyone else got any idea's for me on how to fix this problum I am haveing.
Re: Delete Markred Record DBase III
Hello,
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.
Jason
Re: Delete Markred Record DBase III
Killazz whould you have a example of how to do this please.
Re: Delete Markred Record DBase III
Thanks for the help I managed to do it now.