The information in this article applies to:
- Microsoft Visual FoxPro for Windows, versions 3.0 and 3.0b
SYMPTOMS
When committing a new record to a remote view, you may receive this error:
Connectivity error: [Microsoft][ODBC SQL Server Driver][SQL Server]
The column <xxx> in table <yyy> may not be null.
Where <xxx> is the name of the remote data's field and <yyy> is the name of
the table to which the record is being added.
CAUSE
This error can occur for two reasons:
- When you add a record to a remote table, all fields in the view must be
marked as updatable. Usually the key field is not marked as updatable by
default, which will cause this error to occur with <xxx> being the name
of the key field.
-or-
- The new record is not completely entered with data and one of the fields
is updated as .NULL. instead of being given a valid value for the data
type. For example a SQL Server bit data type cannot accept .NULL.
values; it requires a logical True (.T.) or False (.F.) to be in the
Visual FoxPro remote view. If it isn't, <xxx> will be the name of the
field that requires a non-null value.
RESOLUTION
Mark the key field as updatable or fill the field that can't support null
values with valid data.
STATUS
This behavior is by design.
MORE INFORMATION
Steps to Reproduce Behavior
- Using View Designer, create a remote view to the Authors table in the
SQL Server Pubs database. Select all fields in the table by double-
clicking the asterisk (*) in the table window. Click the Update Criteria
tab and make the Au_id field the key field. Click Update All. Make sure
there is no check mark in the Update and Pencil columns of the field
name list.
- Click Send SQL Updates.
- Run the View. Press CTRL+Y to add a record. Add data to the first three
fields of the record.
- Use the keyboard or mouse to select another record. The error will
occur.
- Use =TABLEREVERT() to reverse the change.
- Type USE in the Command window to close the cursor.
- Go back to View Designer. Make the key field updatable.
- Follow the steps again. Notice the error is the same, but now it is
pointing to the Contract field. This field cannot except a null value.
It must be either true or false. Once this value has been entered, you
can leave the record without error.