jeudi 8 janvier 2015

Weird behavior with checking if record exists in DB:

I am trying to execute a query before inserting new records in DB following is the query:



SELECT * FROM Details WHERE Name = '112' AND BirthDate = '2009-01-08'


Actually I take values for name and Birthdate from textboxes and check if the record exists. Although the Name type is text in DB.


I get the following error:


Failed to read row 0, column 112 from a CursorWindow which has 1 rows, 1 columns.


In the above column 112 keeps changing according to the number I associate with the Name in the said query. So if I enter 113 for name the column changes to 113.


Here is my table creation string:



private static final String DATABASE_CREATE0 = "create table Details (_id integer primary key autoincrement, "
+ "BirthDate text, " +
"Name text not null, " +


What can be the problem here? This error does not occur if the starting character of my Name field is an alphabet.


Aucun commentaire:

Enregistrer un commentaire