John Luciani

John Luciani

  • NA
  • 23
  • 17.6k

DefaultValue of a datetime column in a TableAdapter

Apr 19 2012 3:52 PM

I have an Access table with a datetime column. The Default Value is set to NOW(), as I want it to insert the date in which the record is inserted. Null values are not allowed.

In my corresponding Table Adapter in Visual Studio 2010, when I select that column and view Properties, under DefaultValue it has <DBNull>. If I try to change this to GetDate(), it won't let me.

What's the proper way to do this?

I am getting the:

Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

error when I try to execute a Table Adapter query that simply tries to return all the rows.


Answers (3)