sqllite prepared delete statment returning unknown error

this is a strange one i can not figure out. anyone able to shed some light on it…

this code works fine. row gets deleted and no error returned.

me.SQLExecute("DELETE FROM categories WHERE id="+str(item.id))

this code gets a unkown error, but the row does get deleted…

ps = categories.Prepare("DELETE FROM categories WHERE id=?") ps.BindType(0, SQLitePreparedStatement.SQLITE_INTEGER) data = ps.SQLSelect(item.id)

i can’t figure it out at all O_o

What’s the message in categories.errormessage?

Unkown Error

Is item.id a textfield or a numeriek field?
In the SQLExecute statement you make the field a string field and in the second example not.
I believe you should also use quotes in the first example (when it is a text field).

me.SQLExecute("DELETE FROM categories WHERE id='" + str(item.id)) + "'"

I’m just starting to use prepared statements but shouldn’t there be a bind statement?

ps =  categories.Prepare("DELETE FROM categories WHERE id=?")
  ps.BindType(0, SQLitePreparedStatement.SQLITE_INTEGER)
  ps.Bind(0, item.id)
  data = ps.SQLSelect

:frowning:
Couldn’t change my reaction anymore.

I forgot to close the SQLExecute statement with a ).
Furthermore I meant that the field id in categories is a text or a numeric field, not item.id.

I really hate I it when I can’t edit my reaction although I’m the one with the last reaction.
(Reload doesn’t give me the possibility the edit either)

me.SQLExecute("DELETE FROM categories WHERE id='" + str(item.id) + "'")

The last line of your code should read

ps.SQLExecute(...

and not

data = ps.SQLSelect(...

gee i am a twat. that was it Eli. thanks.
thats what i get when i stay up late coding.
thanks so much.