Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Large ACCESS 95 ODBC headache
Message
From
13/11/2001 15:16:21
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00580677
Message ID:
00581096
Views:
22
Y'know....mayhaps I shouldn't try to program on little to no sleep - it only leads to BFoMP's.

Thanks for the reminder, it was one of those where I went "Gad's I'm an idiot, I KNEW that".




>Dorris,
>
>First, there's a limit of 8,192 characters per command line in VFP. If there're more VFP generates 'Syntax error'. Second, you cannot use VFP variables directly in SQL statements in SQLEXEC(). However you can use parameters in SQLEXEC()
msql1 = "Insert into VendorMaster (pk_vend) values (?pkvend)"
>x = sqlexec(mchand,msql1,"drslts")
In this example parameter ?pkvend will be substituted with the value of variable m.pkvend before SQL statement is executed.
>
>
>
>>Or, maybe I've just got the headache and this isn't helping....
>>
>>I'm trying to insert a record into an Access 95 table and I either get a Syntax error (which is coming from trying to pass a numeric in a string) or, I get an error that says "Too few parameters. Expected x", where x is the number of fields in my Fields section....the chunk of code in question is...
>
>>  dcfld = "PK_VEND,LOCALNUM,VENDORNUM,NAME,APPRSTAT,APPRYR," +;
>>    "PHYSINCAREOF,PHYSADDR1,PHYSADDR2,PHYSCITY,PHYSCOUNTY," + ;
>>    "PHYSFIPS,PHYSSTATE,PHYSZIP,PHYSZIP4,PHYSTELEPHONE," + ;
>>    "BILLINGINCAREOF,BILLINGADDR1,BILLINGADDR2,BILLINGCITY," + ;
>>    "BILLINGCOUNTY,BILLINGFIPS,BILLINGSTATE,BILLINGZIP," + ;
>>    "BILLINGZIP4,BILLINGPHONE,ENROLLDT,VENDSTATUS,STATUSDT," + ;
>>    "NEWSSNTID,OLDSSNTID,SPECCD,VENDTYPE,LASTLIQDDT,LASTAUTHDT," + ;
>>    "GROUP,MCAIDPROVFLAG,MCAIDPROVNUM,FISCALFLAG,DIRECTDEPOSITFLAG," + ;
>>    "NOTES,LASTCHGUSER,LASTCHGDT,CREATEDT,CREATEWHO"
>>
>>  insstr = "m.pkvend,val(m.cidcnum),m.vendid,m.vendname,m.apprstat,mapyr," + ;
>>    "m.incareof, m.vendaddr1, space(30), m.vendcity, val(m.vendcnty)," + ;
>>    "2*val(m.vendcnty) - 1, m.vendstate, m.vendzip5, m.vendzip4, m.vendphone," + ;
>>    "vendmast.vendname, vendmast.vendaddr1, vendmast.vendaddr2, vendmast.vendcity," + ;
>>    "val(vendmast.vendcnty), 2*val(vendmast.vendcnty)-1, vendmast.vendstate, vendmast.vendzip5," + ;
>>    "vendmast.vendzip4, vendmast.vendphone, mdtfunc, m.vendstatus, m.vendstatdt," + ;
>>    "m.vendnewssn, m.vendoldssn, m.specialty, m.vendtype, m.liqddate, m.authdate," +;
>>    "iif(recc('indvs')>1,' ','C'), m.medprov, m.mednum, m.onfiscal, iif(vendmast.venddirdep,'Y','N')," +;
>>    "m.notes, muserid, mdtfunc, mdtfunc, muserid"
>>
>>  msql1 = 'Insert into VendorMaster (' + dcfld + ') values (' + insstr + ')'
>>  x = sqlexec(mchand,msql1,"drslts")
>
>>all of the variables are defined, mdtfunc = datetime() (Access apparently didn't like the function)
>>
>>I've tried cutting it down to:
>>msql1 = "Insert into VendorMaster (pk_vend) values (m.pkvend)"
>> this gives me the "Parameters" error
>>
>>I CAN get it to work with:
>>msql2 = "Insert into VendorMaster (pk_vend) values (28448)"
>> this works (after the sqlexec stmt).
>>
>>Help me! Help me, ObiWan KeFoxPro!
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Previous
Reply
Map
View

Click here to load this message in the networking platform