tableadapter update query RRS feed

  • Question

  • I have been trying to figure this out for a few days now.   I have an oracle db table that has 4 columns.  When  a specific event occurs, I need to insert a new entry into this table (EventName [string], EventID [Integer], TriggerTime [Timestamp], Status [String])  When the event is complete I should update this entry's status.

    I have tried using both tableadapters and oracle commands to update this table and nothing works.  I have no problem using the tableadapter insert method to initially add the new entry to the table but when I try to update the table, nothing happens.  I am using a bind variables in both cases. 

    Here is the update query.

    UPDATE "TerLog" SET "Status" = 'Completed' WHERE "TriggerTime" = :time

    I have even tried using the to_date conversion function

    UPDATE "TerLog" SET "Status" = 'Completed' WHERE "TriggerTime" = TO_DATE(:time
    , 'MM/DD/YYYY HH24:MITongue TiedS')

    I put this same query into the oracle tool, SQL developer (witha  value for time), and it works fine.  what am i doing wrong

    Monday, November 3, 2008 5:59 PM

All replies

  • Are you calling da.UPDATE command or ds.AcceptChanges? don't remember which.




    Monday, November 3, 2008 6:24 PM
  • An update command was produced from the table adapter wizard.  in the code I call the tableadapter.Update and put in the bind variable values.  Unfortuantely I cannot get the datetime variable to every work correctly
    Monday, November 3, 2008 6:31 PM
  • So your problem isn't the update functionality per se, it's the date parameter?


    Please post that code.



    Monday, November 3, 2008 6:40 PM
  • Correct - I am am having trouble entering the date parameter into the query using the tableadapter wizard

    My customer UPDATE command was configured in the table adapter configuration wizard as this

    UPDATE "TerLog"
    SET "Status" = 'Completed'
    WHERE ("TriggerTime" = TO_DATE(:time, 'mm/dd/yyyy hh24:miTongue Tieds)

    This is the insert code
    Dim ta as New DataSet1TableAdapters.TerLogTableAdapter
    Dim timme as Date = Format(DateTime.Now, "MM/DD/yyyy HH:mmTongue Tieds")

    Dim result as Integer = ta.Insert("TriggerInsertTest",0,timme,"Started")

    The update call is
    result = ta.UpdateQuery(timme)    '// i want to update the status that i just entered

    This gives the error ora-01858  a non-numeric character was found where a numeric was expected

    I know this query works but I can't seem to figure out how to enter the time bind variable
    Monday, November 3, 2008 6:58 PM