0

i am now created a database and i had created a table called GAME with fields...i wrote select query for this table to check field existence....while running my code for accessing the table it shows no such table exception.....i have created that table in SQlite manager not in code..i dono why this error showing...the database contains table in assets folder....please explain why this error.....please help me.....thanks in advance

objdatabase.rawQuery("SELECT ADMIN_ACCESS_CODE,ACCESS_CODE FROM GAME WHERE ADMIN_ACCESS_CODE='"+strPassword+"'", null);
CATIEEE
  • 45
  • 1
  • 9
  • Is the table's name GAME or Game or game? – Pedro Oliveira Sep 11 '14 at 10:22
  • yup its GAME only......:-( – CATIEEE Sep 11 '14 at 10:24
  • Just because the database file is on assets folder that doesn't mean it's on android system. Can you show us the code where you copy it from the assets to the android system? – Pedro Oliveira Sep 11 '14 at 10:26
  • i have copied the whole database from another application and paste that in asset folder directly not in code.... – CATIEEE Sep 11 '14 at 10:29
  • Yes. But that's how it works. Your sql query will be executed on the android system. Not in the file on the assets folder. Refer to this to copy the database from the assets folder to the system. http://stackoverflow.com/questions/18805874/copy-database-from-assets-to-databases-folder – Pedro Oliveira Sep 11 '14 at 10:30
  • y so....is it not enough just copying...????? – CATIEEE Sep 11 '14 at 10:38
  • Refer this link for handling database from assets folder : http://stackoverflow.com/questions/2605555/android-accessing-assets-folder-sqlite-database-file-with-sqlite-extension – VVB Sep 11 '14 at 10:40
  • have you used your DDMS Perspective to check whether the database actually exists before querying – danidee Sep 11 '14 at 10:48
  • yes i have wrote this code checkdatabase() but its returning true everytime...:-( – CATIEEE Sep 11 '14 at 11:17
  • nope.......i havent used that perspective yet.....what it is used for.....please tell me the usage...@danidee – CATIEEE Sep 11 '14 at 11:19
  • sorry yES YES i have used that prespective..but that shows database saved in emulator storage only know..@danidee – CATIEEE Sep 11 '14 at 11:31

1 Answers1

-1
objdatabase.rawQuery("SELECT `ADMIN_ACCESS_CODE`,`ACCESS_CODE` FROM `GAME` WHERE `ADMIN_ACCESS_CODE`='"+strPassword+"'", null);

try this

Angad Tiwari
  • 1,738
  • 1
  • 12
  • 23