I am using VB to write an application that queries and updates .DBF files.
There's a 4-byte header (offsets 4-7) in a .DBF indicating how many records are in the file. See here:
When I do an SQL "INSERT INTO" statement, this header is updated correctly.
When I do "DELETE FROM", the header isn't even touched.
Example: I insert 1000 records into a table. The header shows 1000 records. When I remove all 1000 records, the header still shows 1000. A "SELECT COUNT(*)" statement returns a value of 0.
If I open the .DBF in Excel (I don't have Visual FoxPro) and simply save it, the header is updated correctly.
Anyone familiar with this? Here's a snippet of my code when I'm doing a delete:
Dim Conn = CreateObject("ADODB.Connection")
Conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & datapath & ";Extended Properties=DBASE IV;")
Conn.execute("DELETE FROM table WHERE somerecord = somevalue")
Conn.close()
TIA
There's a 4-byte header (offsets 4-7) in a .DBF indicating how many records are in the file. See here:
When I do an SQL "INSERT INTO" statement, this header is updated correctly.
When I do "DELETE FROM", the header isn't even touched.
Example: I insert 1000 records into a table. The header shows 1000 records. When I remove all 1000 records, the header still shows 1000. A "SELECT COUNT(*)" statement returns a value of 0.
If I open the .DBF in Excel (I don't have Visual FoxPro) and simply save it, the header is updated correctly.
Anyone familiar with this? Here's a snippet of my code when I'm doing a delete:
Dim Conn = CreateObject("ADODB.Connection")
Conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & datapath & ";Extended Properties=DBASE IV;")
Conn.execute("DELETE FROM table WHERE somerecord = somevalue")
Conn.close()
TIA