What am I doing wrong: Update Record

Yafuhenk

Active Member
Licensed User
Longtime User
Hi

Can anyone tell me why this code gives the error shown below?

B4X:
Dim SQLString As String
   SQLString = "UPDATE Figures SET Forecast = 1000 WHERE rowid = 20"
   Cursor2 = SQL1.ExecQuery(SQLString)
   SQLString = "SELECT Forecast FROM Figures WHERE rowid = 20"
   Cursor3 = SQL1.ExecNonQuery(SQLString)
   Cursor3.Position = 0
   Log(Cursor3.GetDouble2(0))

Compiling code. Error
Error compiling program.
Error description: Cannot assign void value.
Occurred on line: 58
Cursor3 = SQL1.ExecNonQuery(SQLString)
Word: )

Henk
 

Harris

Expert
Licensed User
Longtime User
I do not see in your code:
Dim Cursor2, Cursor3 as Cursor
 
Upvote 0

Ricky D

Well-Known Member
Licensed User
Longtime User
also the UPDATE statement is a NonQuery

INSERT, UPDATE & DELETE are NonQueries

SELECT is a Query

B4X:
    SQLString = "UPDATE Figures SET Forecast = 1000 WHERE rowid = 20"    
    Cursor2 = SQL1.ExecQuery(SQLString)

should be

B4X:
    SQLString = "UPDATE Figures SET Forecast = 1000 WHERE rowid = 20"    
    SQL1.ExecNonQuery(SQLString)
 
Upvote 0

Yafuhenk

Active Member
Licensed User
Longtime User
Thanks for the replies

Shame on me:signOops:
Mixing up ExecNonQuery and ExecQuery!
I changed it but still get the same error.
Please see the printscreen.

Henk
 

Attachments

  • update.JPG
    update.JPG
    52.1 KB · Views: 185
Upvote 0

Yafuhenk

Active Member
Licensed User
Longtime User
Yes that did it!
Thank you all

I am almost 50 years old now and still I go to fast sometimes:eek:

Henk
 
Upvote 0
Top