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: bmcdonald27 <member33342_at_dbforums.com>
Date: Tue, 15 Jul 2003 14:33:14 +0000
Message-ID: <3112008.1058279594@dbforums.com>

I didn't read the entire post and replies, but saw that you were having troubles getting a Date in VB format into oracle. Is this true?

If so, try this

You could instead of using a Text Box, use a Masked Edit Control and specify ##/##/#### as the mask. That will only enable them to enter numerics. and the formatting will be already there in VB Date format.

Then do the below to convert it to Oracle Date format

Dim strDate as string

'********************* COMMENTS **************************'
'format the date into the oracle format dd-mmm-yyyy (unless it is set
differently on your system.
'********************* COMMENTS **************************'
strDate = Format(Date, "dd-mmm-yyyy")

'********************* COMMENTS **************************'
'then perform your insert string something like
'********************* COMMENTS **************************'
"INSERT INTO table1 (fieldintablefordate) VALUES ('" & strDate & "')"

'********************* COMMENTS **************************'
after VALUES ... that is a "single quote" and then a "double quote" to end the string then "&" to concatenate the string with the value in strDate then "&", open double quote, single quote close parenthesis, and close the string w/ another dbl quote.
'********************* COMMENTS **************************'

--
Posted via http://dbforums.com
Received on Tue Jul 15 2003 - 09:33:14 CDT

Original text of this message

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