Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Validate date from VB to insert into Oracle table
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.comReceived on Tue Jul 15 2003 - 09:33:14 CDT