Groups | Blog | Home
all groups > dotnet windows forms databinding > march 2005 >

dotnet windows forms databinding : Can't add a record to Access DB - "Column xxx does not allow Nulls"



MrMibs via DotNetMonster.com
3/31/2005 10:52:35 PM
I'm trying to use a form created with the VB.NET Data Form Wizard. When I
try to test the form by adding data, I get the above error message (the
record does not get added and it erases a non-related field!).
The value in the field is not a NULL value. This seems only to happen to
key fields - no matter what data type. I changed the data type and the key
field in Access 2003, and got the same message with the new key field even
though the data type was now numeric. There must be a work-around for this
otherwise it makes this tool unusable. I saw another post with a similar
problem (Sept 2004) only the guy did not use the wizard to create the form -
so maybe the problem is within OleDB and not the wizard per se. Any
advice/work-around would be greatly appreciated.

--
Alex Passos
4/11/2005 2:00:33 PM
You cannot add records to a table that would cause the primary keys to
collide. Primary keys must be unique values (or combinations thereof) and
may only appear once in the table.

Example: ID, FirstName, Last Name (ID is primary key)

100, Joe, Bob Add => OK
101 Jill, Smith Add => OK
100 John, Doe Add => Not OK (100 is already in the table).

Alex

[quoted text, click to view]

AddThis Social Bookmark Button