Wednesday, March 21, 2012

Getdate Problem

Hi ,

I have problem with Getdate()

i want to create Guest book with VWD 2005 and SQL 2005

I have same problem here forQ1,

http://forums.asp.net/thread/1513111.aspx

I put the Defualt value for the date : getdate()

and then I create insert page, but i got the error below

I tried to [Allow Null] for the data field in sql 2005, but when I add new entries, there is no date entered to the DB.

Can you Help.

thank you

------------

Cannot insert the value NULL into column 'guestdate', table 'tour2.dbo.gues'; column does not allow nulls. INSERT fails.
The statement has been terminated

Given that a record can be entered when allow nulls is set to true, I'm guessing that there is a problem with how getdate() is written in the default value. Try changing the default value to include outside parenthesis, like: (getdate())

Good luck!

|||

Hey

What is the create statement for the table?

You could execute insert statement in Sql Server Management studio to see if it works.


Here is an Example:

create table test_default_value(column1datetime defaultgetdate(),column2varchar(32))insert into test_default_value (column2)values('test')
sql

No comments:

Post a Comment