Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL INSERT to MS Access Failing
Message
 
 
To
01/11/2011 10:46:54
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01527718
Message ID:
01527779
Views:
102
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform