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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Binding Null Date

Status
Not open for further replies.

techsmith

MIS
Jun 27, 2003
114
GB
Has anyone managed to get databinding to update a MSSQL date attribute TO NULL?

I have an extended datepicker control, but I need to make sure it supports binding. I am testing this against a form created by the wizard.

I can display an existing NULL value, but I can't get the binding to support changing an existing date value to any kind of NULL. I've tried passing it as SQLDateTime.Null and System.DbNull.Value.

I checked out the DataForm wizard to see how it might be done. The wizard uses a textbox and passes the Date values and Null as a string. However, even this doesn't handle changing an existing date back to NULL.

Any help would be appreciated - I'm googled out!
 
Hello techsmith,

I haven't tried that but it is on my list of things to do. If you could post a bit of code I may have some time this weekend to play with it a bit. As an aside, have you tried using Nothing?

Have a great day!

j2consulting@yahoo.com
 
Thanks for taking the time to look into this. The story so far...

I have experimented with several approaches to this including returning sqldatetime, string and object type versions of NULL/Nothing. All of these approaches give me some way of returning a NULL.

The ERRORS came when the control is being bound to something that is in itself based on datetime such as the dataset/datadapter created by the dataform wizard.

I am now thinking - do I try to change the behaviour of datetime or approach it from the other end, i.e. use stored procedures for binding so that I can pass the min value or date(0) and then interpret this as a NULL in the stored procedure.

I don't expect to find an answer immediately, but I appreciate any help getting there before we switch to the 2005 version, which apparently has nullable datatypes - although I've not had time to look into it yet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top