Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Problem developing app

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am a not experienced developer. All I want to do is make a small app to track information of football on TV. I want to do it through a small DB however I've been struggling a lot with an error I've been trying to discover in the last two weeks but I have not been able.

I have teh following code in the class I create the DBHowever when I try to run it, the debugger shows and error that says:

E/Database(330): android.database.sqlite.SQLiteException: no such table: games: , while compiling: INSERT INTO games(gchannel, ggame, gtime, gdate, gcompetition) VALUES(?, ?, ?, ?, ?);

I’ve trying to change parameters and many things but I haven’t found where the problem is. Can someone help me please?
 
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look at the error, it says no such table: games, means the table does not exist in database, so changing parameters won't help.
 
Julian Meber
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Swastik Dey wrote:Look at the error, it says no such table: games, means the table does not exist in database, so changing parameters won't help.



Yes Swastik I know what the error says, but if yo notice in the code I am creating that table !! I do not know what the problem can be.
 
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Julian Me wrote:

Swastik Dey wrote:Look at the error, it says no such table: games, means the table does not exist in database, so changing parameters won't help.



Yes Swastik I know what the error says, but if yo notice in the code I am creating that table !! I do not know what the problem can be.


Table creation takes place in onCreate method - which is invoked by onUpgrade method.

But who calls onUpgrade method?

Also, why to keep table creation stuff in same class as data manipulator? (unless you want to drop and create table each time).
 
Anayonkar Shivalkar
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And Welcome to CodeRanch!
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Julian Me wrote:I have teh following code in the class I create the DB...


Julian, in future please UseCodeTags (←click). I've added them for you this time - and see how much easier it is to read now?

[EDIT: I also split your long declaration line (72). Very long lines in code blocks tend to screw up the windowing here.]

Winston
 
Marshal
Posts: 74371
334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the advice you have been given to separate table creation from querying the data is good. I shall move this thread to our databases forum.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Julian, please BeForthrightWhenCrossPostingToOtherSites
http://forum.xda-developers.com/showthread.php?t=1681612

edit http://www.java-forums.org/new-java/60291-problem-developing-app-android.html
 
Julian Meber
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Uff.. looks really nice. thanks all for you help, I am still learning many things.

Thank you.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic