Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do you eliminate spaces in a variable
Message
De
27/05/2003 20:36:48
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00793254
Message ID:
00793325
Vues:
40
Nick

VFP has fixed length characte fields and when inserting into a remote view it will pad all the character columns with spaces. The only exception to this is a memo. I think I read that you can set the new cursor adapter class in vfp8 to trim the charaters. The other option is to build your own insert and update statements.
lcSql = [insert into mytable (field1,field2) values (']+allt(m.field1)+[',']+allt(m.field2)+[')]
?sqlexec(lnHndl,lcSql,"cr_results")
>How do you prevent spaces from being inserted into a access table when you are doing "insert into" command either throught spt or sql commmand.
>For example I am trying to insert following data. The one that seems to give me problem is "A21 = 'kern61701'". I do an alltrim in sql statement (although it doesn't work with spt) and when I go and check my access database I have data as 'kern61701 ' with bunch of spaces at end. I need these spaces gone because it is used a a filename in access database. Here is my code:
>
>
>A21 = 'kern61701'
>.....
>.....				
>										
>INSERT into ITCCursor (IDNumber, BadgeType, CreateDate, ChangeDate, Operator, PrintCount);
>	 VALUES ((x),ALLTRIM(A21),DATE(),DATE(),"admin",0)
>lnRes = TABLEUPDATE(.t.,.t.,'ITCCursor')
>IF lnRes = .F. && update failed above try again directly on server table
>	lcSql = "INSERT into ITCFields (IDNumber, BadgeType, "  ;
>		+ " CreateDate, ChangeDate, Operator, PrintCount) " ;
>		+ " VALUES (?x,?ALLTRIM(A21),DATE(),DATE(),'admin',0) "
>	lnRes = SQLEXEC(THISFORM.nCon,lcSql)
>ENDIF
>

>
>Thanks
>Nick Patel
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform