DB operation problem

  • Thread starter Thread starter N! Xau
  • Start date Start date
N

N! Xau

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(myQuery, con)
mycmd.CommandType = CommandType.Text
Dim adapt As New OracleDataAdapter(mycmd)

Try
mycmd.ExecuteNonQuery()
adapt.Fill(myId, "tab_myId")
c1_read = CStr(myId.Tables("tab_myId").Rows(0).Item("c1"))
c2_read = CStr(myId.Tables("tab_myId").Rows(0).Item("c2"))
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
mycmd = Nothing
End Try
End Sub
 
N! Xau said:
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(myQuery, con)
mycmd.CommandType = CommandType.Text
Dim adapt As New OracleDataAdapter(mycmd)

Try
mycmd.ExecuteNonQuery()
adapt.Fill(myId, "tab_myId")
c1_read = CStr(myId.Tables("tab_myId").Rows(0).Item("c1"))
c2_read = CStr(myId.Tables("tab_myId").Rows(0).Item("c2"))
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
mycmd = Nothing
End Try
End Sub
So what, exactly, is being stored in c1_read and c2_read (presumably
declared as String elsewhere?) when this code executes?
 
Peter van der Goes:
So what, exactly, is being stored in c1_read and c2_read (presumably
declared as String elsewhere?) when this code executes?


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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top