Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determine record which causes error
Message
From
20/10/2005 23:22:48
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, United States
 
 
To
20/10/2005 14:34:16
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
01060385
Message ID:
01060964
Views:
7
Andrus,

What I was trying to get at is to display or store each Primary key before doing the insert so you can tell which row failed to insert. If you can't use scatter and gather then you can always to the old Append blank and replace .... The key is to know what row is being inserted before you insert it.

Personnaly, I quit using updateable cursors years ago. I now use SPT all the time so I can control exactly what goes to the database and how the errors are handled.

>James,
>
>this works in VFP 9 only. I need to run my application in VFP 7 since VFP 9 application does not start in Win 98.
>Also, in case of backend error in INSERT command, VFP sends automatically a ROLLBACK command to backend. This discards all added rows (see other message).
>
>How to fix those two problems ?
>
>Andrus.
>
>>How about Scatter name otable memo
>>insert into mytable from name otable
>>
>>
>>>James,
>>>
>>>thank you.
>>>I have lot of columns in table and lot of memory variables.
>>>scatter memvar memo overwrites memory variables which have same names as table fields. So I cannot use it.
>>>
>>>How to avoid existing memory variable destroying ?
>>>
>>>
>>>>Andrus,
>>>>
>>>>I would not use append from and insert each row.
>>>>
>>>>
>>>>select mytable
>>>>scan
>>>>  scatter memver memo
>>>>  ?m.pk
>>>>  insert into newrecords from memvar
>>>>  skip in mytable
>>>>endscan
>>>>
>>>>
>>>>>I need to add records to a table in PostgreSQL server .
>>>>>
>>>>>I ceated a SPT cursor mytable and made it updatable.
>>>>>It has row buffering enabled. VFP sends each row as separate INSERT command to backend.
>>>>>
>>>>>I use the following code to add records to sql server:
>>>>>
>>>>>
SELECT mytable
>>>>>APPEND FROM dbf('newrecords')
>>>>>
>>>>>Some record violates referential integrity and this causes error
>>>>>in APPEND FROM line
>>>>>
>>>>>Connectivity error: ERROR: insert or update on table
>>>>>"mytable" violates foreign key constraint "mytable_customer_fkey"
>>>>>
>>>>>How to determine the record in newrecords table which causes this error ?
>>>>>Which is best way to add many record so that the row caused error can be determined ?
Previous
Reply
Map
View

Click here to load this message in the networking platform