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: Gary <rooty_hill2002_at_yahoo.com.au>
Date: 16 Jun 2003 20:26:19 -0700
Message-ID: <171bd226.0306161926.63a6db1a@posting.google.com>


Me <me_at_privacy.net> wrote in message news:<9pfievsp7sk9jp1bl7tff7e1lbd4739685_at_4ax.com>...
> On Fri, 13 Jun 2003 01:51:30 GMT, Jim Kennedy wrote:
>
> >It is this type of programming that gives people the impression that VB
> >programmers are not professional programmers. If you don't know how to do
> >exception handling in VB (or can't read the documentation) then find
> >another profession. (eg flip burgers) People who are going to suceed in
> >this type of industry are people who are somewhat self reliant and can do a
> >little research.
> >
> >Again in VB dates are a formatted string (and not even done well, since you
> >have to rely on the settings of the client machine - cause vb "programmers"
> >by and large don't understand the difference between something and the
> >formatted representation of something. (yeah some do, but they are the ones
> >where VB is just another language under their belt.) Look in the Oracle
> >docs for to_char and to_date and format masks. Also you might try reading
> >the documentation on whatever driver you are using.
> >Jim
>
> I don't become a VB programmer in 3 days, do I?
> This was my 3rd day programming in VB.
>
> Reading the manual, or buying a good book or refering to the Oracle 8i
> Bible will always solve my problem. I could definately search
> somewhere on the web, or probably take a cource at some esteemed
> institution. I could try VB forums etc. etc. there is always an
> alternative to asking in a newsgroup, isn't there?

Hi!

Don't be frustrated. People are trying to help you out and one may not expect to get fed for everything.

My suggestion is never use isdate() at all, at least I have never used it and I have used VB prior to 4.0.

Basically, a date in VB is a string and only means a "date" in VB. It doesn't mean it will be a "date" in MSSQL, neither in Oracle, in fact not in any database. They are different systems and have different definitions of a "date" data ( the one in VB makes least sense though). You may find you are lucky your code works for some cases when a date you formatted on the front end MATCHES what is defined in your database (though you are luckier if you use MSSQL, in Oracle, you've got virtually no chance if you don't cling to those date conversion function).

To help you stay away from isdate(). Try this:

1. create a standard exe in VB;
2. put a text box on it;
3. put a command box next to the text box;
4. put the following code in sub command1_click():
   if isdate(text1.text) then
      msgbox "good one!"
   else
      msgbox "bad one!"

   end if
5. run the exe and try 12/13/2003 first and then try 13/12/2003. 6. if you are happy with the result, I may ask for pay cut tomorrow.

BTW, isnull() is better, but I suggest you always stick a "" to the end of a "string" before you put it into your business logic provided you may be confused by the difference between NULL and blank space.

Gary Received on Mon Jun 16 2003 - 22:26:19 CDT

Original text of this message

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