Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Validate date from VB to insert into Oracle table

Re: Validate date from VB to insert into Oracle table

From: Jim Kennedy <kennedy-down_with_spammers_at_attbi.com>
Date: Thu, 12 Jun 2003 12:46:30 GMT
Message-ID: <GC_Fa.1209988$F1.143004@sccrnsc04>


Hate "dates" in VB because it is a string and not a real data type. They should have a date data type in VB, but that would be too difficult for the average VB programmer to understand. (they would get confused about the difference between date and the string representation of a date - happens in Oracle all the time, with people comparing strings with dates).

There isn't enough information here to help you. You are using some sort of API to talk to Oracle and it really is an API question. My crystal ball has been busted and not back from the repair shop yet. Basically, it is a date as a string problem. One way around that is to use to_date which is an Oracle function. (see docs) I don;t know how your API deals with such things so you will have to figure it out. As to your other question on insert. You need to again add error handling ot your application, trap the error and display it and not let it propagate upwards and fail. Jim

-- 
Replace part of the email address: kennedy-down_with_spammers_at_attbi.com
with family.  Remove the negative part, keep the minus sign.  You can figure
it out.
"Me" <me_at_privacy.net> wrote in message
news:2ksgev0ppalusu67a53f45p6m7ssr7v1c3_at_4ax.com...

> I have a problem in that the date format of VB and that of oracle 8i
> don't match
>
> For example:
> Private Sub Command1_Click()
> ' Check user input
> If Not IsDate(Text1) Then
> MsgBox "Sorry! That is not a valid date or Date/Time.", vbCritical
> & vbOK, "Error"
> Exit Sub
> End If
>
> Validates a date for VB but the same date format is not compatible
> with Oracle and I get an error when I try to insert values.
> How can this be solved?
>
> Next, when ever I try to insert wrong values into tables from vb
> Eg a null value into an attribute that cannot be null, I get an error
> and the VB project is ended. How can I prevent this?
> i.e.
> Is there a way to get the error message (from oracle) show it to the
> user and then continue running the project?
>
> This question is probably for a VB group, but you know, I kind of feel
> at home here; after being flamed many times :)
>
> Thanks.
>
Received on Thu Jun 12 2003 - 07:46:30 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US