A alexdoan101 Member Licensed User Longtime User Apr 20, 2011 #1 1.) How do I delete a row for the the SQLTable4 example? 2.) How do i shift rows up and down in the SQLTable4 example ??? (like the Scrollviewlist example...this uses a list...)
1.) How do I delete a row for the the SQLTable4 example? 2.) How do i shift rows up and down in the SQLTable4 example ??? (like the Scrollviewlist example...this uses a list...)
A alexdoan101 Member Licensed User Longtime User Apr 20, 2011 #2 please cancel...found the solution..thanks nevermind...found the solutions...thanks. Upvote 0
M Merlot2309 Active Member Licensed User Longtime User Apr 20, 2011 #3 Hello Alex and welcome to the B4A community. And a question: Can you tell me how to delete a row from a table? To be more specific: User selects a row, presses the delete button and beside removing the row from the table, the record also has to be deleted from the sql-db. The table row contains a unique id-field. Until now I only got wrong results with RemoveAt BangHead: ) Thank you very much in advance. Helen Upvote 0
Hello Alex and welcome to the B4A community. And a question: Can you tell me how to delete a row from a table? To be more specific: User selects a row, presses the delete button and beside removing the row from the table, the record also has to be deleted from the sql-db. The table row contains a unique id-field. Until now I only got wrong results with RemoveAt BangHead: ) Thank you very much in advance. Helen
NJDude Expert Licensed User Longtime User Apr 20, 2011 #4 You mean the MySQL query to delete a row like this? Code: DELETE FROM DB_TABLE WHERE (UserName = '$user_name')"; Upvote 0
You mean the MySQL query to delete a row like this? Code: DELETE FROM DB_TABLE WHERE (UserName = '$user_name')";
M Merlot2309 Active Member Licensed User Longtime User Apr 22, 2011 #5 Hi NJDude and thanks for your reply. To be honoust SQL delete is not so much the problem. On selecting a row in a table and pressing a Delete button the row has to be deleted (of course). I have an ID field in the table which is the key for the database record. From a forum post I found RemoveAt but can't get it working. Thanks in advance, Helen. Upvote 0
Hi NJDude and thanks for your reply. To be honoust SQL delete is not so much the problem. On selecting a row in a table and pressing a Delete button the row has to be deleted (of course). I have an ID field in the table which is the key for the database record. From a forum post I found RemoveAt but can't get it working. Thanks in advance, Helen.
JMB Active Member Licensed User Longtime User Apr 22, 2011 #6 Deleting row Hi Helen This is a real gash answer to what you want to do... If you added a little bit of code which set a global variable ID to the Code of the last row selected, then you could use the following code to delete the last selected item from the database. I've then used the subs ClearAll and ReadSQLTable to rebuild the table. Sub DeleteSelectedItem SQL1.ExecNonQuery("DELETE FROM table1 WHERE table1.Code = '" & ID & "'")ClearAllReadSQLTableEnd Sub The piece of code that sets the ID is added into the end of Sub SelectRow(Row As Int) ...... ID=GetView(Row,0).Text Hope this helps. It removes the last selected item from the database and from the table - albeit rather crudely. You can adapt as required for your database obviously. JMB Upvote 0
Deleting row Hi Helen This is a real gash answer to what you want to do... If you added a little bit of code which set a global variable ID to the Code of the last row selected, then you could use the following code to delete the last selected item from the database. I've then used the subs ClearAll and ReadSQLTable to rebuild the table. Sub DeleteSelectedItem SQL1.ExecNonQuery("DELETE FROM table1 WHERE table1.Code = '" & ID & "'")ClearAllReadSQLTableEnd Sub The piece of code that sets the ID is added into the end of Sub SelectRow(Row As Int) ...... ID=GetView(Row,0).Text Hope this helps. It removes the last selected item from the database and from the table - albeit rather crudely. You can adapt as required for your database obviously. JMB
klaus Expert Licensed User Longtime User Apr 23, 2011 #7 There is an example here: ScrollView example with multiselecting and SQL The progame allows: - adding a row - moving a selected row up and down - mono-selection - multi-selection - deleting rows, mono and multi Best regards. Upvote 0
There is an example here: ScrollView example with multiselecting and SQL The progame allows: - adding a row - moving a selected row up and down - mono-selection - multi-selection - deleting rows, mono and multi Best regards.
M Merlot2309 Active Member Licensed User Longtime User Apr 23, 2011 #8 JMB and Klaus: thank you! And Klaus: this was exactly what I was looking for. Thought I had missed something but saw you just added this example today. Thank you so much. Helen. Upvote 0
JMB and Klaus: thank you! And Klaus: this was exactly what I was looking for. Thought I had missed something but saw you just added this example today. Thank you so much. Helen.