Solved

Dbase 4 access?

Posted on 2000-05-12
6
363 Views
Last Modified: 2013-11-24
Hi!

How can i open an existing DBase 4 Database (dallg1.dbf)?

How can i read and write Recordsets?

Thanks in advanced

Pierre
0
Comment
Question by:Falke
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
ID: 2803738
This is one way to open a dBase IV table using the Microsoft Visual Foxpro Driver in code. You will need a reference to ADO in your project. You can then manipulate the ADO recordset in the normal way, using .Addnew /.Update etc to add records.

Dim cnnDBase As New Connection
Dim rstDBF As New Recordset
cnnDBase.ConnectionString = "Driver={Microsoft Visual Foxpro Driver};UID=;PWD=;SourceDB=C:\Private\;SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;Deleted=Yes;"
cnnDBase.Open
rstDBF.Open "SELECT * FROM <Table>",cnnDBase, adOpenDynamic, adLockOptimistic
With rstDBF
  msgbox .recordcount
  msgbox .fields(0).name & " : " & .fields(0).value
  .AddNew
  .fields(0).Value = "Hello"
  .Update
End With
rstDBF.Close
cnnDBase.Close
Set rstDBF = Nothing
Set cnnDBase = Nothing
0
 

Expert Comment

by:Alexander_Simons
ID: 2804117
Create a new .mdb file, link the dbase4 table you want to use

Now you can perform read/write/delete actions to the dbase4 tables by just  using simple dao functions from vb to access the .mdb file !
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 2804135
Alexander, I see that you are new here. I am happy to welcome you to this site and hope that you find much here useful. Also that you will be able to contribute much in the future.

However, it is considered bad practice to lock a question by posting an answer, see guidelines on http://www.experts-exchange.com/info/expertonly.html
especially when a satisfactory comment has already been posted. You give very little detail in your "Answer". Whilst using an access mdb is in some cases an acceptable technique, and DAO is a perfectly valid data access methodology.

The user may not wish to include the Jet engine and other components in the application. This adds a significant overhead to the footprint of the installed application and doesn't add anything over and above the functionality available using my method. Furthermore DAO will become obsolete in the future as Microsoft is likely to concentrate much more on the ADO technology as used in my example.

I would ask that you withdraw your "answer", feel free to add additional comments to this and other threads.

Falke:

Should Alexander_Simons not withdraw his answer I would suggest that you reject it and ask for more information should my comment not be sufficient for you.


0
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 

Expert Comment

by:Alexander_Simons
ID: 2804708
Alexander_Simons changed the proposed answer to a comment
0
 

Author Comment

by:Falke
ID: 2806456
Your Code TimCottee doesn't work.

I have tried in another way, by using DATA objects, but if i run this code, it return an error
that the file doesn't exist, but it exist. In designermode i can do all perfectly, but in runtime
it occured always an error. (I am using DAO 3.6).

Maybe there is another option? I have to export data's into a DBF for older Programms,
maybe you know how i can make a DBF and make fields and insert data (it would be also possibility).



Data1.DatabaseName = "D:\Export\Kallg1.dbf"
Data1.Connect = "dBASE IV;"
Data1.RecordSource = "SELECT * FROM [KALLG1]"
Data1.Refresh
MsgBox Data1.Recordset.RecordCount
MsgBox Data1.Recordset.Fields(0).Name & " : " & Data1.Recordset.Fields(0).Value
0
 

Author Comment

by:Falke
ID: 2832766
You have not said something about

ADODBC reference, with ADO 3.6 it doesn't work. First i have to remove reference to ADO 3.6 so the NEW statment works.

Thanks a lot.....

Falke
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This collection of functions covers all the normal rounding methods of just about any numeric value.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question