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: mpduncan02 <member32564_at_dbforums.com>
Date: Fri, 04 Jul 2003 15:22:00 +0000
Message-ID: <3075628.1057332120@dbforums.com>

At the risk of asking an obvious question have you tried format() ?

I have been doing a bit of VB<>mySQL and its mySQL dates are non VB friendly also.

Whenever I need to store a date value in mySQL i use something like: ' Set up the SQL update.
strSQL="UPDATE the_table SET this_date ='" & format(strThisDate,"YYYY-MM-DD") & "' WHERE index = '" & intIndexPointer &"'"
' Now send it to the database
dbConn.execute strSQL

Originally posted by Me
> 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.

--
Posted via http://dbforums.com
Received on Fri Jul 04 2003 - 10:22:00 CDT

Original text of this message

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