Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Add a field to a cursor
Message
De
31/01/2001 16:10:29
 
 
À
31/01/2001 14:26:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00470825
Message ID:
00470904
Vues:
33
>>>Hi All,
>>>
>>>I have a cursor where I can add records, replace info in the fields but thats it. I would like to know how to add a field to this cursor. I have tried the following.
>>>
>>>nconhandle = sqlexec(nhandle, csqlstatement, 'temp_cursor')
>>>
>>>IF nconhandle < 0
>>> THISFORM.bad_connect
>>> RETURN
>>>ENDIF
>>>
>>>IF USED('empl_cursor')
>>> SELECT empl_cursor
>>> USE
>>>ENDIF
>>>
>>>USE DBF('temp_cursor') AGAIN IN 0 ALIAS empl_cursor
>>>
>>>SELECT empl_cursor
>>>* Here I need to add an undetermined number of fields.
>>>FOR nfld_cntr = 1 TO (ALEN(specprojarray) / 2)
>>> ctemp_fld = ALLTRIM(spec_proj_array(nfld_cntr, 2))
>>> ALTER TABLE DBF('empl_cursor') ADD COLUMN &ctemp_fld N(8,2)
>>>ENDFOR
>>>
>>>What is it that I am missing here? Any help is apreciated.
>>>
>>>TIA
>>>Mike
>>
>>Mike, ALTER TABLE requires exclusive use of the table.
>
>Nick,
>
>This is not really a table. It is temporary cursor returned from SQL Server. There is probably a workaround. I would create a read/write cursor from the structure, add the new field, and then add the data to the new cursor.

Just change your ALTER TABLE DBF('empl_cursor') to ALTER TABLE empl_cursor.

That should work.
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform