P Pappsegull Member Licensed User Longtime User Oct 23, 2011 #1 Hi, I'm from sweden and did just buy this lovely software:icon_clap: so this is my first post. I have start to play with it and I really enjoy:sign0060: I did find those syntax to delete all records from a table here at w3schools: DELETE FROM table_name or DELETE * FROM table_name I have try both but get syntax error so I use to DROP and CREATE DB.ExecNonQuery("DROP TABLE table_name") DB.ExecNonQuery("CREATE TABLE table_name(Name TEXT, Value NUMERIC)") Is there any other syntax to delete all records from a table? Thanks!
Hi, I'm from sweden and did just buy this lovely software:icon_clap: so this is my first post. I have start to play with it and I really enjoy:sign0060: I did find those syntax to delete all records from a table here at w3schools: DELETE FROM table_name or DELETE * FROM table_name I have try both but get syntax error so I use to DROP and CREATE DB.ExecNonQuery("DROP TABLE table_name") DB.ExecNonQuery("CREATE TABLE table_name(Name TEXT, Value NUMERIC)") Is there any other syntax to delete all records from a table? Thanks!
Erel B4X founder Staff member Licensed User Longtime User Oct 23, 2011 #2 I would have expected "DELETE FROM table_name" to work. Which error do you get in the logs (right pane)? Upvote 0
I would have expected "DELETE FROM table_name" to work. Which error do you get in the logs (right pane)?
S Smee Well-Known Member Licensed User Longtime User Oct 23, 2011 #3 This is the code i use to delete everything from a table and it works correctly Code: Copy SQLQry="DELETE FROM TableName" SQL.ExecNonQuery(SQLQry) Obviously you dont need to define the string first it is just one of my hangovers from using LONG Sql queries Joe Upvote 0
This is the code i use to delete everything from a table and it works correctly Code: Copy SQLQry="DELETE FROM TableName" SQL.ExecNonQuery(SQLQry) Obviously you dont need to define the string first it is just one of my hangovers from using LONG Sql queries Joe
D devlei Active Member Licensed User Longtime User Oct 23, 2011 #4 I have limited experience, but also found some SQL (W3Schools) commands were different than for SQLite. The 2nd option (DELETE * FROM tablename) has always worked for me. If it is not working for you, there must be some other error on your side. Upvote 0
I have limited experience, but also found some SQL (W3Schools) commands were different than for SQLite. The 2nd option (DELETE * FROM tablename) has always worked for me. If it is not working for you, there must be some other error on your side.
P Pappsegull Member Licensed User Longtime User Oct 23, 2011 #5 Solved Thank you, now it works I think the failure was due not to the table was in the database. Coz there was a old version on the device. I don't know where to find the SQLite database on my C: drive that the AVD create! Anyone else that knows? (DBDir = File.DirInternal: DBName = "sql_cc.db") Now I have have found and added the error handler, which makes it easier to find the errors myself Try Catch End Try I guess I'm too eager to write code and do not like to read. :sign0144: But there is so much fun that I, with my old VB3 - VB6 skills can start develop for Android. I'm too old and slow in the brain to learn a new programming language. /Jan, Sweden Upvote 0
Solved Thank you, now it works I think the failure was due not to the table was in the database. Coz there was a old version on the device. I don't know where to find the SQLite database on my C: drive that the AVD create! Anyone else that knows? (DBDir = File.DirInternal: DBName = "sql_cc.db") Now I have have found and added the error handler, which makes it easier to find the errors myself Try Catch End Try I guess I'm too eager to write code and do not like to read. :sign0144: But there is so much fun that I, with my old VB3 - VB6 skills can start develop for Android. I'm too old and slow in the brain to learn a new programming language. /Jan, Sweden
S Smee Well-Known Member Licensed User Longtime User Oct 24, 2011 #6 I guess I'm too eager to write code and do not like to read. But there is so much fun that I, with my old VB3 - VB6 skills can start develop for Android. I'm too old and slow in the brain to learn a new programming language. Click to expand... Join the club A lot of us are exactly the same but it is still a lot of fun :icon_clap::icon_clap: Upvote 0
I guess I'm too eager to write code and do not like to read. But there is so much fun that I, with my old VB3 - VB6 skills can start develop for Android. I'm too old and slow in the brain to learn a new programming language. Click to expand... Join the club A lot of us are exactly the same but it is still a lot of fun :icon_clap::icon_clap: