I asked a similar question yesterday, but I still couldn't solve my problem. I am sharing the problem as a photo. How can I solve this?
1 Answer
I'd say it's because your strings aren't enclosed in ' or ": it's always better to wrap them to avoid errors. Try changing the query into [...] VALUES ("erol", "bascifci", "[email protected]", "testtesttest")
6 Comments
SonerB
Sorry i'm new to this. Can you explain with an example to be clear?
il_boga
The line 47 of the code you posted should look like this:
'"${json[UserTitle.name]}", "${json[UserTitle.surname]}", "${json[UserTitle.email]}", "${json[UserTitle.password]}"'; It is quite hard to read, but I simply wrapped each ${...} between ". In this way, each field will be included in quotes, and SQL will know that they are Strings and not part of the querySonerB
thanks. but ı got a another error. SqfliteDatabaseException (DatabaseException(no such table: table_name (Sqlite code 1 SQLITE_ERROR): , while compiling: INSERT INTO table_name (name, surname, email, password) VALUES ('testname', 'testsurname', '[email protected]', 'test123'), (OS error - 2:No such file or directory)) sql 'INSERT INTO table_name (name, surname, email, password) VALUES ('testname', 'testsurname', '[email protected]', 'test123')' args [])
il_boga
That means that
table_name is a table that doesn't exist. You need to put in line 49 the real name of your users table.SonerB
thanks dude. I fix this. Delete app and restart debugging and its work. thanks again.
|
