Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Insert not working why?
Message
De
05/09/2012 16:28:32
 
 
À
05/09/2012 13:44:52
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
MS SQL Server
Divers
Thread ID:
01552421
Message ID:
01552440
Vues:
57
Ok, found the problem - one of the strings has a contraction in it (didn't) which SQL is reading as a string ending. I've got to be able to store strings with contractions in it, it's an English test question - what's the best way to handle this?


It didn't like your code either.

>It looks like you have forgotten INTO. Btw, your code will be much easier to write, read and debug if you use Text-Endtext, like this
>Text to msql1 textmerge pretext 1+2+4+8 
>   Insert into dli_testing..CATMaster (Category, DiffLetter, alc, Keyword, Keyword2, CorrectResp,
>       Script, Stem, RespA, RespB, RespC, RespD, ScriptTime, TestType, OrigItmId, EnterDate, Completed)
>       Values (<<m.cat>> , <<m.diff>> , << m.alc >>, <<m.keyword>> , <<m.keyword2>> , <<m.correctresp>>,
>          <<m.script>> , <<m.stem>> , <<ALLTRIM(m.respa)>> , <<ALLTRIM(m.respb)>>,
>         <<m.testtype>> , <<m.itmnum>> , <<DTOC(m.enterdate)>> , << m.completed>> )
>Endtext
>ms1 = SQLEXEC(mconn,msql1)
>>Hi gang
>>
>>I have the following code/commands
>>
>>
>> msql1 = "Insert dli_testing..CATMaster (Category, DiffLetter, alc, Keyword, Keyword2, CorrectResp," + ;
>>    + "Script, Stem, RespA, RespB, RespC, RespD, ScriptTime, TestType, OrigItmId, EnterDate, Completed)" + ;
>>    + " Values ('" + m.cat + "', '" + m.diff + "', '" +  m.alc + "', '" + m.keyword + "', '" +  m.keyword2 + "', '" +  m.correctresp + "', '" ; 
>>    + m.script + "', '" +  m.stem + "', '" +  ALLTRIM(m.respa) + "', '" +  ALLTRIM(m.respb) + "', '"   ;
>>    + >
>>    +  m.testtype + "','" + m.itmnum + "','" + DTOC(m.enterdate) + "', '" +  m.completed + "')"
>>ms1 = SQLEXEC(mconn,msql1)
>>
>>
>>It returns no error and no rows affected.
>>
>>What am I missing?
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform