Results 1 to 4 of 4

Thread: Vb 6 Update Stmt Into Oracle Db

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2007
    Posts
    1

    Vb 6 Update Stmt Into Oracle Db

    My application is in VB 6 and am using an Oracle database behind it. I am trying to run the following sql update statement using variables in vb. I keep getting an error when it tries to insert the date (finish = '" & aTask.Finish & ). If I take out the part w/ the dates, my database record updates fine. I've tried using the to_date function and several other methods but can't seem to fix it. Any ideas? And for example, when I run debug and mouse over the aTask.Finish variable the date format that shows is 5/25/2007 5:00:00 PM

    m_Connection.Execute ("update tblprojectschedule set TaskName='" & aTask.Name & "'" & ", ComplePercent='" & aTask.PercentComplete & "'" & " " & ",finish = '" & aTask.Finish & "', where ctwprojno = '" & IndivProjectFileName & "'" & " " & "And relno = '" & aTask.Text9 & "'")

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Vb 6 Update Stmt Into Oracle Db

    Welcome to VBForums

    Thread moved to Database Development forum

    How you put dates/times into SQL statements depends on the database system, and while I don't use Oracle myself, I have replicated what is contained in the help files in the article How do I use values (numbers, strings, dates) in SQL statements? from our Database Development FAQs/Tutorials (at the top of this forum)

    Hopefully that will tell you enough to get it working.

  3. #3
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Vb 6 Update Stmt Into Oracle Db

    All Oracle dataes going to the databse should be in the Oracle expected format (DD-MON-YY as a string) So to place todays date (11/20/2007) into Oracle (without using any conversion functions) it should be sent as '20-Nov-07'. The other way is to use the To_Date() funtion of Oracle like this:
    To_Date('11/20/2007','mm/dd/yyyy').

    All database engines require their dates in a specific format and passed a certian way.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  4. #4

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