Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Any way to set today as default in DataSet Designer?

Status
Not open for further replies.

artyk

Programmer
Apr 5, 2006
163
US
I am working with a dataset and some DateTimePicker controls (each being bound to a DateTime field). I had a default value set for the DateTime fields in my table, but as time passes the default date/time is becoming irrelevant. Is there any way to set that to now? It is set to DBNull right now, which is wrong. Thanks in advance.
 
I think that you use "GETDATE()" for the default value.
 
Thanks for the response. I got a "Property Value is not valid." error. I think that would probably work in code, however this is a dataset that I am setting up at design time and I need something that will work in the DataSet Designer. So far the only things that I can find that work are "<DBNull>" and an actual date and time. I could just pick a date to use as the default, but I think it would be much cleaner to use today's date, regardless of whatever date that happened to be. Thanks.
 
After testing some code, i don't think that you can do this with a DataTable. You could set the item using DateTime.Now() when you create a new row.
 
I was afraid of that. Thanks for your time!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top