PDA

View Full Version : updating dBase files through VB code


shreeniwasbhide
01-15-02, 02:18
Hello,
I am an intermidiate level VB Developer.I am developing an
application in VB6 for Hotels.I am maintaining database in Access for
my application. Now the customer is using another application for
accounting purpose which uses Clipper/dBase combination.He wants me
to make entry to this dBase database while a bill is prepared through
my VB application, to avoid makimg mannual entries to his accounting
software.
I am not able to update the dBase database through VB Code.
Can anybody help me out of this?
Regards
Shreeniwas bhide

vududoc
01-18-02, 08:22
Several years ago, when I attempted to use VB6 with clipper/xbase, it intermittently caused "not a dbase file" errors, and was unable to handle the IDX, CDX and NSX indexing. Haven't used xbase since. Good luck!

Lytech
03-12-02, 16:07
Problem: Microsoft does not support updating dbase tables in it's newer data access components. This is a political thing with the makers of dbase... yada yada yada

Solution: Use an older solution, specifically DAO version 3.5. It works beautifully, and is actually quicker than ADO.

Code base:
Dim db as database
Dim rs as recordset
Dim strSQL as string

Set db = DBEngine.Workspaces(0).OpenDatabase("C:\DataPath\", 0, 0, "dBase III;")

strSQL = "SELECT ... From ... WHERE ...";"
Set rs = db.OpenRecordset(strSQL)

'if you want to edit do something like
rs.addnew
rs![something] = something else
rs.update

'or you can do direct updates like
strSQL = "DELETE ... WHERE ...));" 'or update, or insert into etc etc
db.Execute strSQL

The only real catch here is that you have to add the older DAO 3.51 object library to your app, but I have had a similar situation (older app written in clipper with dbase tables) and I like the performance of the dbase so much better than the mdb files that I am sticking with it!!!

Hope it helps!

Michel
01-05-03, 06:06
Hi

I have the same problem as Shreeniwas bhide, I tried the DAO 3.51 provider, it really works by opening and updating the dabse files, but the problem is that the index files (*.mdx) are not updated too.
So I have to reindex the tables after each time i post transactions through my VB program, to be able to open the delphi/Dbase program.

So please if you have any solution about updating the indexes files when updating the database files let me know...

playernovis
01-05-03, 23:33
check this
http://support.microsoft.com/default.aspx?scid=kb;EN-US;230125

and this
http://support.microsoft.com/default.aspx?scid=KB;en-us;q238431



jiri

TwoSnap
01-29-03, 01:40
I am using a similiar method to pull data in from a series of dBase tables in a VB6 app, but am having a different problem. Any help would be greatly appreciated. The app works fine except when opening certain tables, it generates the error: External table isn't in the expected format. Interestly these same files are not able to open with Excel either, however they do open with various dbf viewing apps I found on download.com. In your example, the error would occur on the line: Set rs = db.OpenRecordset(strSQL)

My thinking is that there is some issue with the way that Jet is looking at this table, and is therefore not able to open it. I have tried changing to dBase III, dBase IV and referencing DAO 3.5, 3.1, etc. nothing seems to work.

Any thoughts?

Thanks in advance.

playernovis
01-29-03, 02:54
unfortunatelly DBF extension was used for many different database formats

dBase III+, IV and 5
FoxBASE+
FoxPro
Visual FoxPro
Clipper
HiPer-SIx


so task number one is to find out the source....

check this web page for some info....
http://alxsoft.narod.ru


jiri

TwoSnap
01-30-03, 00:50
Thanks for the reply. The source is an application that creates a series of files as sort of an export according to a definition. The definition states only that the files are 'dBase'. Looking closely it seems that they vary from dBase III to dBase IV. When isolating a single file for testing purposes, it doesn't seem to make any difference if I specify III or IV.

Thanks,

TS.