• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 148
  • Last Modified:

Record update problem

I am connecting to an oracle database thru VB. One of the fields I am working with is a date field. If the date field already has a date in it, and I delete the date, and then update the record, I get an error, rather than the date being 'erased'. Any suggestions as to why this is happening would be appreciated.~~~~Crit
0
Crit
Asked:
Crit
1 Solution
 
caraf_gCommented:
Crit,

Maybe the date field was defined as "NOT NULL" in your database?

In that case it cannot be empty.
0
 
CritAuthor Commented:
caraf_g,
I just checked the database, and that is not the case. I can, through, SQL Plus update the date to an empty string, just not through VB
0
 
caraf_gCommented:
Can you show me the line of code that's causing the problem?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
ZenMasterCommented:
Have you tried to send a 00/00/00 value to the field being deleted?
0
 
jjmartinCommented:
What is the exact error message you are getting?  Perhaps you are trying to fill the field with invalid data such as slashes from an input mask, but no date?
0
 
mark2150Commented:
Seen quite a bit of discussion on this in the VBData list I subscribe to. Seems that you *CAN'T* leave clear a date field to a blank. The conversion from Date data type does not allow for *no* value, everything will evaluate to *some* date. 0/0/00 doesn't work because it's not a valid date. The only solution that I've seen is to set it to some *bizzarre* date well out of range and use that as a "no date" value. Your display code will then need some logic to detect the out of range value and display something meaningful. Problem comes when you're dealing with people's birthdates and two digit years. Since it's not all that uncommon for people to live for 100 years or more you're going to get painted into a corner where there is *NO* valid "no date" value with a two digit year. (sigh).

Only way out is to recast the database and change the field type from Date to Text and then you can place in null values. *BUT* downside is that you lose the inherent validation and system location independence that DATE provides.

M

0
 
CritAuthor Commented:
thanx for your help...........I'll let my boss sweat the rest!
Crit
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now