Formatting Dates and Null Handling

  • Thread starter Thread starter Jeff Goodman
  • Start date Start date
J

Jeff Goodman

If there is a better newsgroup to post this in, please let me know.

I am a relatively new VB.NET/SQL 2000 programmer.

I am working with data imported into SQL2K from Access. Many of the dates
are null, such as the terminate date with current employees.

I have written the search function to find a certain employee, and now I am
editing the selected records. Several of the fields are date fields, and I
am trying to format them so they display just dates, not dates and times.
I have data bound the fields from the stored procedures to the controls on
the edit page, but I do not seem to be able to apply a format to them.

In addition, if the dates come from the database Null and the user does not
change them I want to the leave the field null. But I cannot find a way to
a pass a parameter to the store procedure to represent this Null.

Any help would be appreciated.

Jeff G.
 
Jeff,

There are no "Date" fields in SQL server, Access, Windows or Net. It are all
DATETIME field whatever name they have. If you get them withouth a time,
than you have probabably tranformed them to strings or something like that.

Cor
 
Take the value you get from the database field and do something like this:

DateValue = Date.Parse(dbDateTime).ToShortDateString
-or-
DateValue = Date.Parse(dbDateTime).ToLongDateString
 
Back
Top