By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,344 Members | 1,139 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,344 IT Pros & Developers. It's quick & easy.

DB operation problem

P: n/a
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

Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"N! Xau" <nx**@hotmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
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 [MVP Visual Developer]
Jack of all trades, master of none.
Nov 21 '05 #2

P: n/a
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

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.