android - Search if a field exists in sql db -
i have db key_numero unique.first create new row want check if field have same key_numero.
public boolean playerexists(int inputtext) throws sqlexception { cursor mcursor = null; mcursor = mdb.query(true, sqlite_table, new string[] {key_rowid, key_numero, key_nome, key_cognome, key_ruolo},key_numero+"="+inputtext, null, null, null, null, null); boolean result=mcursor.movetofirst(); return result; } why return true??
because don't data db. should check mcursor.getint(0) there key_rowid of current possition of cursor.
but why did not use autoincrement db?
Comments
Post a Comment