Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can’t use double quotes w/ SQL 7 INSERT
Message
De
15/11/2000 12:51:48
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Can’t use double quotes w/ SQL 7 INSERT
Divers
Thread ID:
00442210
Message ID:
00442210
Vues:
50
I have an odd situation to say the least. I am trying to use double quotes to my SQL INSERT but I can’t make it work. Check this code and my question below please:

** read the values in table
** the NVL funtion is to insert blanks if there is nothing on that field
lc1= NVL(sid,'') && char
lc2= NVL(Appstat,'') && char

** INSERT works here:
l_cSQL = "INSERT INTO ADMStat"
l_cSQL = l_cSQL + " (sid,trkgrp)"
l_cSQL = l_cSQL + " VALUES ("
l_cSQL = l_cSQL + "'" + ALLT(lc1) + "'"
l_cSQL = l_cSQL + ",'" + ALLT(lc2) + "')"
lnResult=SQLEXEC(l_nHandle,l_cSQL)
_CLIPTEXT=l_cSQL
**in this case, this is the value of clip text= INSERT INTO ADMStat (sid,trkgrp) VALUES ('037643431','')

but if I try to change the from single quotes to double like this it will NOT work:
l_cSQL = 'INSERT INTO ADMStat'
l_cSQL = l_cSQL + ' (sid,trkgrp)'
l_cSQL = l_cSQL + ' VALUES ('
l_cSQL = l_cSQL + '"' + ALLT(lc1) + '"'
l_cSQL = l_cSQL + ',"'+ ALLT(lc2) + '")'
lnResult=SQLEXEC(l_nHandle,l_cSQL)

_CLIPTEXT=l_cSQL
value of clip text = INSERT INTO ADMStat (sid,trkgrp) VALUES ("037643431","")

This is the odd thing. Like I said, the second one does not work in the program, but if I get both values of the clip text into the SQL Server Query Analyzer and run them, they BOTH run.
What is wrong?
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform