469,628 Members | 1,200 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,628 developers. It's quick & easy.

System.Data.NoNullAllowedException: Column 'frDateCreated' does not allow nulls

Hi guys!

I get this message when trying to insert a new record into a datatabel which
is part of a dataset connected within VS 2005 (VB) from a datagridview
control via a DataTableBindingSource and TableAdapter to an SQL Server. In
the SQL server the field is declared as "do now allow null", BUT I put the
getdate() function as default value so the field should be automatically
filled with the current date.

So why do I get that exception up there? Does SQL server test for NULL
actually BEFORE inserting the default value? That would be rather stupid,
wouldn't it?

When I insert the record manually via the server explorer, the error does
not occur.

Martin
Jan 17 '06 #1
1 5514
Martin Widmer wrote:
Hi guys!

I get this message when trying to insert a new record into a datatabel which
is part of a dataset connected within VS 2005 (VB) from a datagridview
control via a DataTableBindingSource and TableAdapter to an SQL Server. In
the SQL server the field is declared as "do now allow null", BUT I put the
getdate() function as default value so the field should be automatically
filled with the current date.

So why do I get that exception up there? Does SQL server test for NULL
actually BEFORE inserting the default value? That would be rather stupid,
wouldn't it?

When I insert the record manually via the server explorer, the error does
not occur.

Martin


When do you get the exception, when trying to insert into your local
dataset or when trying to insert into the SQL server? My quess is your
local dataset, which AFAIK, does not know your default values. Try
setting the default value of the column you want on the datatable. That
should clear up your issue.

Chris
Jan 17 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Penn Markham | last post: by
4 posts views Thread by shsandeep | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.