Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP And ADO
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00129800
Message ID:
00130224
Vues:
24
Hi John,

>I am not sure I understand the thinking behind swapping the size/datatype.

There's not much thinking behind that. I found that the error occured when creating a ADO recordset of a foxpro table wich had a number in a field that was of its maximum size (12.34 in a N(5,3) field). I quickly fixed it by making this field a N(6,3) before creating the recordset. I'll think about making all my numeric fields doubles, but that would take a lot of changes.

In the mean time I found something weird doing it my way, maybe you know why this happens. Here is my 'swapping code':

TABLEUPDATE(.T., .T., lcTable)
use (lcTable) exclusive

lnFields = AFIELDS(laFields, lcTable)
FOR lnTeller = 1 TO lnFields
IF laFields[lnTeller, 2] = 'N'
lnSize = laFields[lnTeller, 3] + 1
lnDec = laFields[lnTeller, 4]
ALTER TABLE (lcTable) ALTER COLUMN (laFields[lnTeller,1]) N(lnSize,lnDec)
ENDIF
ENDFOR
USE IN (lcTable)

oRS = CREATEOBJECT('ADOR.RecordSet')
lcSelect = 'Select * from ' + lcTable
oRS.OPEN(lcSelect, 'DSN=AvW', 1, 3)

This works fine in my case, after the recordset had been modified etc. by a DLL I reset the fields to the original size in the laFields Array.
Now playing with your advise about doubles I change the N(lnSize,lnDec) part into B(lnDec) but when trying to change a field in the DLL I get en error (The specified row could not be located for updating. Some vlaues may have been changed since it was last read) Why do I get this error only when using the doubles?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform