Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cannot Insert Value NULL IN Column
Message
From
21/05/2018 03:39:46
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
20/05/2018 14:36:48
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
MS SQL Server
Miscellaneous
Thread ID:
01660168
Message ID:
01660209
Views:
53
>The other alternative is to allow Nulls, with the added complexity that you describe, or to always mention all fields in inserts, which means you need to alter your code each time the table structure changes at the server where you insert rows. Also very problematic if you have tables that have more than 20 columns.

The trouble is with the way insert statement is generated by Fox. At least in cursor adapter, if you subclass it and override the BeforeInsert, you can see the generated statement in the debugger, and guess what, it contains a parametrized statement... Something like
insert into mytable fields (field1, field2, field3...) 
   values (?mycursoralias.field1, ?mycursoralias.field2, ?mycursoralias.field3...)
I've seen cases where this was just too long, though the limit was not 20 columns, I think I hit the wall somewhere around 120 or so. And then using a shorter alias helped a lot - something like two characters.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform