Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Dbase 4 access?

Posted on 2000-05-12
6
Medium Priority
?
365 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
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

We were having a lot of "Heartbeat Alerts" in our SCOM environment, now "Heartbeat" in a SCOM environment for those of you who might not be familiar with SCOM is a packet of data sent from the agent to the management server on a regular basis, basic…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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 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…

604 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