Solved

Dbase 4 access?

Posted on 2000-05-12
6
358 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
  • 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now