Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Updating Date Field to Null or empty string

Updating Date Field to Null or empty string

Updating Date Field to Null or empty string

I am using VB.NET and trying to update a field in a Pervasive database using ODBC (Timberline Data Source to be exact) and am using ADO.
All of my updates work until I try to Null out a date as in the following example with Rehire_Date it errors.

Here is the line in question:
strSQL = "UPDATE MASTER_PRM_EMPLOYEE SET Termination_Date = NULL, Rehire_Date = '" & Format(CDate(txtRH.Text), "yyyy-MM-dd")', Phone_Number = '" & Trim(txtPhone.Text) & "' WHERE Employee = '" & Trim(txtID.Text) & "'"

I have tried NULL, '', 0000-00-00, chr(0) to no avail.
Everything I try gives me the Invalid Date, Time stamp error.

I have spent 4 hours trying to find anything on this with no results.  Please help!!

RE: Updating Date Field to Null or empty string

It's possible that the data doesn't allow a null values for that field.  
If the data allows a "null" value, you might want to check what the value Timberline uses as the "null" value.

Certified Pervasive Developer
Certified Pervasive Technician
Custom VB and Btrieve development.

RE: Updating Date Field to Null or empty string

I figured it out.  After trying everything I decided to try setting the field to a time stamp.  So I set the field to 12:00:00 and believe it or nut it worked!  I looked at the data and it shows up as empty in the database and my app.  I am not understanding why but hey it works!
Thanks for your response.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close