Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL INSERT to MS Access Failing
Message
 
 
À
01/11/2011 10:46:54
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 7 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01527718
Message ID:
01527779
Vues:
101
This message has been marked as the solution to the initial question of the thread.
>Right, that's why I used @@identity in the first place.
>
>But here's another issue that's driving me crazy; The following code works just fine.
>>>
>>>lcSourceFile = "C:\projects\FRS\FRS5Data.accdb" 
>>>pnConnHandle = SQLSTRINGCONNECT("Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" + ;
>>>   					  				  lcSourceFile)
>>>TEXT TO lcSQLCommand NOSHOW
>>>INSERT INTO [TblHousehold] (SYSTEMPROGRAMCD, PROGRAMCD,LSTUPDTDTTM) VALUES (?m.sysprogcd,?m.programcd,?m.lstupdtdttm)
>>>ENDTEXT
>>>
>>>lnResult = SQLEXEC(pnConnHandle,lcSQLCommand)
>>>
>But this below blows up with an error "Connectivity error: etc. Too few parameters. Expected 1."
>
>TEXT TO lcSQLCommand TEXTMERGE NOSHOW
>INSERT INTO [tblHouseholdMember] (HOUSEHOLDSEQNBR,HOUSEHOLDVERSIONNBR,PERSONSEQNBR,LASTNAME) VALUES (&lt&ltlnHouseholdSeqNbr&rt&rt, &lt&ltlnHouseholdVersionNbr&rt&rt, &lt&ltlnPersonSeqNbr&rt&rt,&lt&ltm.lastname&rt&rt)
>ENDTEXT	
>
>Where the contents of the Watch window for lcSQLCommand after the Text Merge are
>
>"INSERT INTO [tblHouseholdMember] (HOUSEHOLDSEQNBR,HOUSEHOLDVERSIONNBR,PERSONSEQNBR,LASTNAME) VALUES (893, 1, 1,Kinch               )"
>So what the heck is up with that?

TEXTMERGE is used in order to expand macro correctly. I'd rather use
<<>>
instead of & macros. Anyway, you're missing quotes around the last value, which is clearly a name field.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform