public void excluir (int codigo){
String[] parametros = new String[1];
parametros[0] = String.valueOf(codigo);
conexao.delete("CLIENTE", "CODIGO = ? ", parametros);}
This is the method to delete a data from my table
This is the method called by the onCLick Button /
public void tirar (View view){
int x = 1;
ClienteRepositorio clienteRepositorio = new ClienteRepositorio(conexao);
clienteRepositorio.excluir(x);
onResume();
}
This is the class where I create my table (Code is increasing)
public class ScriptDLL {
public static String getCreateTableCliente(){
StringBuilder sql = new StringBuilder();
sql.append(" CREATE TABLE IF NOT EXISTS CLIENTE (");
sql.append(" CODIGO INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,");
sql.append(" NOME VARCHAR (250) NOT NULL DEFAULT (''),");
sql.append(" ENDERECO VARCHAR (255) NOT NULL DEFAULT (''),");
sql.append(" EMAIL VARCHAR (200) NOT NULL DEFAULT (''),");
sql.append(" TELEFONE VARCHAR (20) NOT NULL DEFAULT ('') )");
return sql.toString();
}
}
This does not work. When I push the button, nothing happens. It does not delete any data from my table. Any suggestions?