Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Insert not working why?
Message
 
 
To
05/09/2012 13:44:52
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
MS SQL Server
Miscellaneous
Thread ID:
01552421
Message ID:
01552431
Views:
66
It would be even better to use '?' parameters

>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?
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform