Article ID: 833902 - View products that this article applies to.
In a Microsoft Windows application, if you use a data form to add a new record to a database, you may receive the following message:Note Column Name is a placeholder for the name of the column of a table in the database where the primary key constraint exists.
If you use the navigation buttons to move through the records of a database table on the data form, you may receive the following error message:
An unhandled exception of type 'System.Data.NoNullAllowedException' occurred in system.data.dll Additional information: Column 'Column Name' does not allow nulls.
This behavior occurs because the primary key or the not NULL column of the database table was not selected in the Data Form Wizard. If the primary key or the not NULL column of the database table is not selected in the Data Form Wizard when you create the data form, the Add - Creates a new record option is not disabled.
To work around this problem, select the following columns of the selected table when you add a data form by using the Data Form Wizard:
Steps to reproduce the behavior
Create a Microsoft Windows application
Add a Data Form to the Windows application
Set the Data Form as the Startup Object of the project
Verify the Data Form
For more information about the Data Form Wizard, visit the following Microsoft Developer Network (MSDN) Web site:
Article ID: 833902 - Last Review: April 24, 2007 - Revision: 2.4