I want to select column at agregasi table, if exist do something, but if columns does not exist show/print message 'Column does not exist'. I could run code below while columns exist:
String keywords1={'pesawat','terbang'};
String sql1 = "SELECT " + keywords + " FROM agregasi"; //columns exist at agregasi table
Cursor c1 = myDbHelper.rawQuery(sql1, null);
if (c1.moveToFirst()) {
// do something
}
When i using code below, what should i do to print error message?
String keywords2={'psawat','terang'};
String sql2 = "SELECT " + keywords + " FROM agregasi"; //columns does not exist at table
Cursor c2 = myDbHelper.rawQuery(sql2, null);
// what should i do get error message and show/print using toast
Aucun commentaire:
Enregistrer un commentaire