469,352 Members | 1,656 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

How to set the default foe DateTime column in DataSet view

Hi

I have in my DataSet a column of type DateTime. And, I want to change it's default to current date in DataSet view. I tried to use:
- DateTime.Today
- DateTime.Now
- DateTime.Now.ToString("dd/MM/yyyy")

All of them did not work and I got error message:
"Property value is not valid" and the detail is:
The string was not recognized as a valid DateTime. There is a unknown word starting at index 0

How to set the default inside the DataSet?

I am working witn Visual Studio 2008 - C#

Thanks
Dec 16 '08 #1
5 8574
balabaster
797 Expert 512MB
What's the date string itself?
Dec 16 '08 #2
I did not get ur question.

What I have is an autocreated dataset build on a MS SQL table which has a Date field. And, I want to set the default value in dataset directly as it works for other fields in dataset. I don't want to set default value in database itself.
Dec 17 '08 #3
Still waiting for an answer.
Jan 9 '09 #4
The short answer is that there is still no way to set a default value to anything except a constant.

In other words, you cannot use an expression for the default value in any datatable column, which rarely has any impact on non-datetime columns.
Mar 30 '09 #5
if you want to set a fixed default value for a datetime column in the vs designer, try to use a string like:
2009-01-01T00:00:00

bye
ghillo
Jun 25 '09 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Darren Clark | last post: by
2 posts views Thread by nephish | last post: by
4 posts views Thread by =?Utf-8?B?QmFidU1hbg==?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.