?
Solved

Dbase 4 access?

Posted on 2000-05-12
6
Medium Priority
?
364 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 100 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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 

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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Suggested Courses

765 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