Solved

database acces with vb 6.0

Posted on 2000-04-10
3
150 Views
Last Modified: 2010-05-02
on a form, Insert, modify and delete a record on a dbf table with ADODC ( i will apreciate to receive the code to know how to do it!!)
0
Comment
Question by:poirier_i
3 Comments
 

Author Comment

by:poirier_i
Comment Utility
Adjusted points from 15 to 50
0
 
LVL 9

Expert Comment

by:samopal
Comment Utility
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset

cn.Open "DSN=Visual FoxPro Tables;UID=;PWD=;SourceDB=d:\My Work;SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;Deleted=Yes;"
rs.Open "select * from test", cn

' Add new record
rs.addnew
rs.fields(0)=122
rs.fields(1)="xxx"
rs.update

'Edit record
rs.fields(0)=133
rs.update

'Delete record
rs.delete
rs.update

PS Test.dbf is a table in d:/My Work directory

HTH
0
 

Accepted Solution

by:
gfaucher earned 50 total points
Comment Utility
it might be this kind of code. if your ADODC is on the form.

'to insert
adodc.recordset.addnew
adodc.recordset.field(0) = String 'or
adodc.recordset.field("Fieldname") = string
adodc.recordset.update

'to edit
adodc.recorset.field(0) = string
adodc.recordset.update

'to delete
adodc.recordset.delete
adodc.update

and if you want your modification to be visible put adodc.refresh after your update
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

771 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

12 Experts available now in Live!

Get 1:1 Help Now