DB operation problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • N! Xau

    #1

    DB operation problem

    Hi everybody.

    A timer calls the following procedure mySub() to check if two values
    (in an Oracle DB table) had modified.
    Problem is, values stored into c1_read and c2_read are NOT the actual
    values in the database fields.
    Can anybody help? THX


    ....
    Dim myId As New DataSet("myId")
    ....

    Private Sub mySub()

    Dim myQuery As String = "select c1, c2 from T where myParam = 1"
    Dim mycmd As New OracleCommand(m yQuery, con)
    mycmd.CommandTy pe = CommandType.Tex t
    Dim adapt As New OracleDataAdapt er(mycmd)

    Try
    mycmd.ExecuteNo nQuery()
    adapt.Fill(myId , "tab_myId")
    c1_read = CStr(myId.Table s("tab_myId").R ows(0).Item("c1 "))
    c2_read = CStr(myId.Table s("tab_myId").R ows(0).Item("c2 "))
    Catch ex As Exception
    MessageBox.Show (ex.Message)
    Finally
    mycmd = Nothing
    End Try
    End Sub

  • Peter van der Goes

    #2
    Re: DB operation problem


    "N! Xau" <nxau@hotmail.c om> wrote in message
    news:1118763123 .157725.132710@ g44g2000cwa.goo glegroups.com.. .[color=blue]
    > Hi everybody.
    >
    > A timer calls the following procedure mySub() to check if two values
    > (in an Oracle DB table) had modified.
    > Problem is, values stored into c1_read and c2_read are NOT the actual
    > values in the database fields.
    > Can anybody help? THX
    >
    >
    > ...
    > Dim myId As New DataSet("myId")
    > ...
    >
    > Private Sub mySub()
    >
    > Dim myQuery As String = "select c1, c2 from T where myParam = 1"
    > Dim mycmd As New OracleCommand(m yQuery, con)
    > mycmd.CommandTy pe = CommandType.Tex t
    > Dim adapt As New OracleDataAdapt er(mycmd)
    >
    > Try
    > mycmd.ExecuteNo nQuery()
    > adapt.Fill(myId , "tab_myId")
    > c1_read = CStr(myId.Table s("tab_myId").R ows(0).Item("c1 "))
    > c2_read = CStr(myId.Table s("tab_myId").R ows(0).Item("c2 "))
    > Catch ex As Exception
    > MessageBox.Show (ex.Message)
    > Finally
    > mycmd = Nothing
    > End Try
    > End Sub
    >[/color]
    So what, exactly, is being stored in c1_read and c2_read (presumably
    declared as String elsewhere?) when this code executes?

    --
    Peter [MVP Visual Developer]
    Jack of all trades, master of none.


    Comment

    • N! Xau

      #3
      Re: DB operation problem

      Peter van der Goes:
      [color=blue]
      > So what, exactly, is being stored in c1_read and c2_read (presumably
      > declared as String elsewhere?) when this code executes?[/color]


      Yes Peter c1_read and c2_read are class scope variables declared as
      String.
      They are supposed to store the result of an UPDATE query. Fields c1 and
      c2 in DB are actually updated, I can see it with Toad. But if I debug,
      c1_read and c2_read still have the values they had before the Update.


      thanks for help
      N! Xau

      Comment

      Working...