tufanv Expert Licensed User Longtime User Jan 27, 2018 #1 Hello, Let's say for the key "x" I have value "y". If I want to change the value from y to z , I use kvs.put(x,z) but this add the key to last position on kvs. For example if i use kvs.listykeys previous to this , x key is at second position but after this it changes to last position. Is there anyway to to avoid this ? like editing the key instead of removing and adding again without changing the list sequence ? like adding a edit public sup to keyvalue store as it is in put : Code: Public Sub Put(Key As String, Value As Object) sql1.ExecNonQuery2("INSERT OR REPLACE INTO main VALUES(?, ?)", Array As Object(Key, ser.ConvertObjectToBytes(Value))) End Sub and use update ? I am trying to add this to kvs : Code: Public Sub Edit(Key As String, Value As Object) sql1.ExecNonQuery2("UPDATE main SET(?, ?)", Array As Object(Key, ser.ConvertObjectToBytes(Value))) End Sub I dont understand how to use question marks here. What I want to do is Execute : Update main set key=value where key=key TY Last edited: Jan 27, 2018
Hello, Let's say for the key "x" I have value "y". If I want to change the value from y to z , I use kvs.put(x,z) but this add the key to last position on kvs. For example if i use kvs.listykeys previous to this , x key is at second position but after this it changes to last position. Is there anyway to to avoid this ? like editing the key instead of removing and adding again without changing the list sequence ? like adding a edit public sup to keyvalue store as it is in put : Code: Public Sub Put(Key As String, Value As Object) sql1.ExecNonQuery2("INSERT OR REPLACE INTO main VALUES(?, ?)", Array As Object(Key, ser.ConvertObjectToBytes(Value))) End Sub and use update ? I am trying to add this to kvs : Code: Public Sub Edit(Key As String, Value As Object) sql1.ExecNonQuery2("UPDATE main SET(?, ?)", Array As Object(Key, ser.ConvertObjectToBytes(Value))) End Sub I dont understand how to use question marks here. What I want to do is Execute : Update main set key=value where key=key TY
derez Expert Licensed User Longtime User Jan 27, 2018 #2 If Key and Value are the names of the columns in the DB then: Code: Public Sub Edit(Key As String, Value As Object) sql1.ExecNonQuery2("UPDATE main SET Value=? WHERE Key=?", Array As Object( ser.ConvertObjectToBytes(Value), Key)) End Sub Upvote 0
If Key and Value are the names of the columns in the DB then: Code: Public Sub Edit(Key As String, Value As Object) sql1.ExecNonQuery2("UPDATE main SET Value=? WHERE Key=?", Array As Object( ser.ConvertObjectToBytes(Value), Key)) End Sub
tufanv Expert Licensed User Longtime User Jan 27, 2018 #3 derez said: If Key and Value are the names of the columns in the DB then: Code: Public Sub Edit(Key As String, Value As Object) sql1.ExecNonQuery2("UPDATE main SET Value=? WHERE Key=?", Array As Object( ser.ConvertObjectToBytes(Value), Key)) End Sub Click to expand... YEs thanks ! I mistyped the code value for key so it wasnt working Code: Public Sub Edit(Key As String, Value As Object) sql1.ExecNonQuery2("UPDATE main SET Key=? WHERE Key=?", Array As Object( ser.ConvertObjectToBytes(Value), Key)) End Sub Upvote 0
derez said: If Key and Value are the names of the columns in the DB then: Code: Public Sub Edit(Key As String, Value As Object) sql1.ExecNonQuery2("UPDATE main SET Value=? WHERE Key=?", Array As Object( ser.ConvertObjectToBytes(Value), Key)) End Sub Click to expand... YEs thanks ! I mistyped the code value for key so it wasnt working Code: Public Sub Edit(Key As String, Value As Object) sql1.ExecNonQuery2("UPDATE main SET Key=? WHERE Key=?", Array As Object( ser.ConvertObjectToBytes(Value), Key)) End Sub