Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to update memo using adchunk and ADO/ODBC?
Message
 
 
À
15/03/2005 19:24:31
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00996096
Message ID:
00996167
Vues:
14
>>I need to update a memo field using ADO from as ASP application. I've looked at KB Q208208. It only shows how to add a new record and populate the memo using the "adchunk" approach. I need to know how use this to update a memo in an existing record. I have a free table with a CDX file that has 3 indices. I need to know how to fetch a single record's memo using a unique key value (like using "set order to" then doing a seek in VFP), and then write back an updated version of them memo, all with ADO. I know the syntax for creating a connection, etc, but I don't know the rules/techniques for performing these simple steps. Can somebody help me? Thanks very much!
>>
>>Here's what I'm getting: Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
>>[Microsoft][ODBC Visual FoxPro Driver]Cannot update the cursor.
>>
>>Here's the code snippet, given the memo field "comments"
>>
>>* This is already done successfully:
>>Select Comments  From MyDBF Where ID=SomeUniqueKeyVal
>>* ID is a field that is indexed alone in a rushmore-optimized index
>>* Assume the connection is named "conn" and the recordset is named "rs"
>>* Set up the test:
>>cLongParm=rs("comments") + chr(13) + string(254,"A")
>>liChunkSize = 254
>>Rs.Fields("comments")=""
>>FOR i = 1 to len(lcLongParm) step liChunkSize
>>  liStartAt = i
>>  liWorkString = mid(lcLongParm, liStartAt, liChunkSize)
>>  Rs.Fields("comments").AppendChunk(liWorkString)
>>NEXT
>>conn.execute "Set Reprocess to 5 seconds",,1
>>* This fails:
>>Rs.Update
>>
>
>It's saying "Cannot update the cursor". W/o memo can it? It sounds more like a security problem.
>Cetin

Using an UPDATE sql statement passed through ADO works OK, but everything has to be literal (no parameters), and you can't use memo data of more than 254 chars with it. I think you have to use ADO. I've found that if I set RS locking to LockOptimistic and cursortype to openstatic, then RS.Update won't fail with an error but it also won't update anything. I have _really_ searched the web for a solution to this and I'm beginning to wonder if there is one. With a free table, there's no Primary Key defined, and with no PK, I'm wondering if the Update method is supported at all by the VFP ODBC driver through ADO.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform