Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Unable to update CA with C(10) binary field
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Unable to update CA with C(10) binary field
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01042202
Message ID:
01042202
Vues:
61
I take this code from another forum and tried to help the man that use it. Unfortunately I stick with it :o(
Here the code:
LOCAL oca AS CursorAdapter

SET ASSERTS ON

********************
IF EMPTY(SYS(2000,"c:\test.dbf"))
   CREATE TABLE c:\test.dbf (testval C(10) NOCPTRANS)
   APPEND BLANK
   USE
endif
set multilocks on
oca=createobject("cursoradapter")
oca.alias="catest"
oca.buffermodeoverride=5
oca.cursorschema="TESTVAL C(10)"
oca.datasourcetype="ADO"
*oca.mapbinary=.T.
oca.selectcmd="Select * From test"
oca.tables="test"
oca.SendUpdates       = .t.
oca.updatablefieldlist="TESTVAL"
oca.updatenamelist="TESTVAL test.TESTVAL"
oca.keyfieldlist="TESTVAL"

loConnDataSource = createobject('ADODB.Connection')
loConnDataSource.ConnectionString = [Provider=VFPOLEDB.1;Data Source=c:\test.DBF;Password="";Collating Sequence=MACHINE;]
loConnDataSource.Open()
oca.DataSource = createobject('ADODB.RecordSet')
oca.DataSource.CursorLocation   = 3  && adUseClient
oca.DataSource.LockType         = 3  && adLockOptimistic
oca.DataSource.ActiveConnection = loConnDataSource
oca.cursorfill(.t.)
SELECT catest
**INSERT INTO CaTest VALUES ("Test")
***GO BOTTOM
replace testval WITH TRANSFORM(RECNO())

IF TABLEUPDATE(1)
ELSE
   ASSERT .f.
   =AERROR(amessage)
   =MESSAGEbox(amessage(2))
ENDIF
USE IN cATest
This code always stops on ASSERT with "Microsoft Cursor Engine : Multiple-step operation generated errors. Check each status value."

This code not works in VFP9 too. What I am missing? Generaly I use ODBC for my Cursor Adapters so I am not so familiar with ADO.

I have the latest VFPOLEDB installed


UPDATE: Sorry for stupid mistake in the Title, of course it is not a FILE it is a FIELD :o(
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform