When the Allow Nulls property on a field is marked as false, the client library will prevent the update or insertion of a blank value.
The application generator will set Allow Nulls to “false” for all fields based on mandatory table columns when the baseline application is constructed.
For example, the Employees table does not allow null values in First Name field, but does allow null values for Title field. An asterisk (*) is placed next to the field name to indicate required fields.
If the value is cleared in First Name field and user attempts to save the record, the client library will prevent the update and display a message next to the field.
Let’s allow nulls in First Name and prevent nulls in Title.
Start the Project Designer. Switch to the controllers tab in the Project Explorer and double-click on Employees / Fields / FirstName field node.
Enable Allow Nulls:
Property | New Value |
Allow null values. | True |
Press OK to save the field. Notice that the asterisk (*) next to the FirstName field node has been removed to indicate that the field is no longer required.
Double-click on Employees / Fields / Title field node.
Mark the field as required:
Property | New Value |
Allow null values. | False |
Press OK to save. On the Project Designer toolbar, press Browse.
Navigate to the Employees page and edit the details of a record. The First Name field is not marked as required, but the Title is.
Clear the values from both First Name and Title fields, and try to save the record by pressing OK. A message will be displayed next to the Title field.
Enter a value in Title and save again. This time the action will be passed to the server. However, the FirstName column in Employees table is still marked as required in the database. An error message will be raised by the database engine and displayed at the top of the page. Changes will not be persisted.