Yafuhenk Active Member Licensed User Longtime User Feb 28, 2012 #1 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
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 Feb 28, 2012 #2 I do not see in your code: Dim Cursor2, Cursor3 as Cursor Upvote 0
klaus Expert Licensed User Longtime User Feb 28, 2012 #3 B4X: SqlString = "SELECT Forecast FROM Figures WHERE rowid = 20" Cursor3 = SQL1.ExecNonQuery(SqlString) must be: B4X: SqlString = "SELECT Forecast FROM Figures WHERE rowid = 20" Cursor3 = SQL1.ExecQuery(SqlString) Best regards. Upvote 0
B4X: SqlString = "SELECT Forecast FROM Figures WHERE rowid = 20" Cursor3 = SQL1.ExecNonQuery(SqlString) must be: B4X: SqlString = "SELECT Forecast FROM Figures WHERE rowid = 20" Cursor3 = SQL1.ExecQuery(SqlString) Best regards.
Ricky D Well-Known Member Licensed User Longtime User Feb 29, 2012 #4 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
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)
Yafuhenk Active Member Licensed User Longtime User Feb 29, 2012 #5 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 52.1 KB · Views: 185 Upvote 0
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
klaus Expert Licensed User Longtime User Feb 29, 2012 #6 You should read Ricky Ds' post more carafuly, he posted be: B4X: SQL1.ExecNonQuery(SQLString) and not B4X: Cursor2 = SQL1.ExecNonQuery(SQLString) Best regards. Upvote 0
You should read Ricky Ds' post more carafuly, he posted be: B4X: SQL1.ExecNonQuery(SQLString) and not B4X: Cursor2 = SQL1.ExecNonQuery(SQLString) Best regards.
Yafuhenk Active Member Licensed User Longtime User Feb 29, 2012 #7 Yes that did it! Thank you all I am almost 50 years old now and still I go to fast sometimes Henk Upvote 0