Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Empty fields go back as NULL?
Message
From
10/07/2002 00:55:26
Vladimir Zhuravlev
Institute of the Physics of Earth,Russia
Moscow Region, Russia
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00676856
Message ID:
00676908
Views:
14
>I've created a table on SQL Server with several fields, specifying them not to allow null values. I have also created a basic form operating on a remote view of this table. My basic problem is when I add a new record to the view, fill in some of the fields and issue a TABLEUPDATE(), I get this error message...
>
>"...Cannot insert the value NULL into column 'cstatus'...column does not allow nulls. INSERT fails."
>
>So, how can I tell VFP not to send empty text fields back as NULL? I've tried doing the following even though I've never heard of doing this...
>
>DBSetProp('V_WORKLOG.cstatus', 'Field', 'DataType', "C(1) NOT NULL")
>
>but this does not help. So, do I have to cycle thru the empty fields and load them with at least a blank? Surely there is a better way to handle this. Funny, I've not seen any discussion of this in any C/S book or article.
>
>Thanks for any help...
>
>Del
You can also use isnull sql server fuction in your view definition , which works similar to VFP nvl.
Put it around all fields , where are possible nulls and name it with filed name.
For example select isnul(nn,0) as nn from something
MVP-2006-2011, PHD in Math and Physics ,
host of www.foxclub.ru,
VFP lector at Interface and Microinform companies
Head science researcher of VNIIA Rosatom.
Previous
Reply
Map
View

Click here to load this message in the networking platform