Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL AND INSERT IN AN ACCESS DB
Message
 
 
To
24/12/1998 12:21:22
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00170282
Message ID:
00170315
Views:
24
You have to adhere to the standard SQL INSERT command. I would create an SQL statement with variables for the values and loop thru it

SEQSTRX = 'INSERT INTO merchant (fld1, fld2, ...) VALUES(?ARRAY[I,1],?ARRAY2[I,2])'
=SQLPREPARE(gnConnHandle,SEQSTRX)

FOR I TO LENARRAY
=SQLEXEC(gnConnHandle)
NEXT I
=TABLEUPDATE(.t.)

I'm not sure of the variable syntax with an array, you'll have to experiment. Worst cast you could use ?v1, ?v2, etc and assign the varibles the array values.

>Thanks for your help Tom, now is there a way to loop thru the array and put the
>values in , EXAMPLE something like:
>
>INSERT INTO MERCHANT VALUES(FOR I TO LENARRAY;ARRAY(I)) OR
>I HAVE TO WRITE EVERY SINGLE ONE
>
>thanksss
>
>happy holidays
>
>>Mark,
>>
>>You can't 'insert from array' in to access because it's a native to foxpro not true SQL. You'll have to use INSERT INTO merchant (fld1, fld2, ...) VALUES(var1, var2, ...)
>>
>>-Tom
>>
>>>I am using the following code
>>>
>>>
>>>gnConnHandle = conector handle
>>>get data.. into array myarray
>>>*- INSERTING DATA TO THE ACCESS TABLE
>>>SEQSTRX = 'INSERT INTO merchant FROM ARRAY myarray'
>>>=SQLPREPARE(gnConnHandle,SEQSTRX)
>>>=SQLEXEC(gnConnHandle,SEQSTRX)
>>>*- END
>>>
>>>and nothing happens, I do connect to the database
>>>and create views with it and now I want to update it
>>>any help in what I am doing wrong??
>>>
>>>mark
-TomC
Previous
Reply
Map
View

Click here to load this message in the networking platform