Results 1 to 4 of 4

Thread: Save oracle date from VB

  1. #1
    Guest

    Post

    Hello

    I'm using this function:
    ------------------------------------
    Public Function OracleDate(InDate As Date) As String
    OracleDate = "To_Date('" & Format(InDate, "dd-mm-yyyy") & "','DD-MON-YYYY')"
    End Function

    * Refer from book
    ------------------------------------

    It come to a little bit confusion to use it when i started to update
    My command:
    -----------------------------------
    rs1.Addnew
    rs1!EOQ = Val(T_EOQ.Text)
    rs1!BATCHNO = T_Batchno.Text
    rs1!UserName = Label1(3).Caption
    rs1!DateLog = OracleDate(InDate)'also error with (To_Date)
    rs1.update
    -----------------------------------
    Problem appear as Variable not Define

    Please help me, TQ.


    ------------------
    Khamal

    [This message has been edited by khamal (edited 12-24-1999).]

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    Where are you getting the InDate variable from, and if the DATELOG field is a DateTime field, why are you putting in (To_Date('12/25/99','12/25/99') as the value of that field? What does To_Date do? Please excuse me if these are Oracle functions, I'm not too familar with the specifics of that DBMS....

    Tom

  3. #3
    Guest

    Post

    Hi Tom

    The To_Date reconise by VB6 as a datetime fuction for oracle date and time, by refering to vb help file ..

    -----------------------------------
    ==Entering Dates in the Grid and SQL Panes==

    When you enter a valid date in the Grid pane, the Query Designer replaces the date you entered with a call to the TO_DATE( ) function, using your date as one of the parameters. This assures that Oracle will correctly interpret that data you have entered.

    You can enter dates directly in the SQL pane, but you must enter them in exactly the format specified for your database, as specified by the current session's NLS_DATE_FORMAT value. Because there might not be an easy way to determine the correct format, it is advisable to use the TO_DATE( ) format in the SQL pane. For example, a query might look like this:

    SELECT EMP_ID, HIRE_DATE
    FROM EMPLOYEE
    WHERE HIRE_DATE > TO_DATE('01/01/90', 'MM/DD/YY')

    For details about the TO_DATE( ) function, refer to the Oracle documentation.
    ------------------------------------------
    The problem occur when i save the date using formatdatetime(Date, "dd-mm-yyyy").

    ex: for date 24 of Dec 1999

    The database reconise it as 24-Jan-00


    ------------------
    Khamal

    [This message has been edited by khamal (edited 12-25-1999).]

  4. #4
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    It's official -- I have no clue.....

    ....but i'm sure you already knew that....



    happy holidays

    Tom

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width