Problem updating field using ADO 
Author Message
 Problem updating field using ADO

I am trying to learn how to use ADO in VB 6. I am using an Access 2.0
database which has two fields, "StrainA" and "StrainA_New". I am trying
to copy "StrainA" to "StrainA_New" in every record.
I have gotten this to work using DAO using the following code:

Dim db as DAO.Database
Dim strSQL as String

db = OpenDatabase("c:\data.mdb")
strSQL = "UPDATE DISTINCTROW tblTriage "
strSQL = strSQL & "SET tblTriage.StrainA_New = [StrainA] "
strSQL = strSQL & "WHERE ((tblTriage.StrainA Like '*'));"

db.Execute strSQL

But when I try the following using ADO, it doesn't work:

Dim cn As ADODB.Connection
Dim strSQL As String

' Open connection to database.
Set cn = New ADODB.Connection
cn.Provider = "Microsoft.Jet.OLEDB.4.0"
cn.ConnectionString = "c:\data.mdb"
cn.Open

strSQL = "UPDATE DISTINCTROW tblTriage "
strSQL = strSQL & "SET tblTriage.StrainA_New = [StrainA] "
strSQL = strSQL & "WHERE ((tblTriage.StrainA Like '*'));"

cn.Execute strSQL
cn.Close

Any idea what I am doing wrong here?



Sat, 23 Feb 2002 03:00:00 GMT  
 Problem updating field using ADO
I get the same problem..Anyone ??? Help


Wed, 27 Feb 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to update datetime field with NULL using ADO update

2. Updating Memo Fields in MS Access using ADO Parameter / Stored Procedures

3. Updating Memo Fields in MS Access using ADO Parameter / Stored Procedures

4. how to update a Numeric field in a table using VB6 ADO

5. ADO Update (using VB) of Memo fields in Access 97 DB

6. ADO Problem Updating number field to Null

7. Memo Field Update Problem ADO JET

8. Problems Updating Excel Spreadsheet using ADO and VB 6.0

9. Updating Excel cells using ADO problem

10. Using--After Update-- to update field in table.

11. 2nd SQL Server update after update text field corrupts row - using RDO

12. Updating data to a memo field using SQL UPDATE

 

 
Powered by phpBB® Forum Software