Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem developing app

 
Julian Meber
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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?
 
Swastik Dey
Rancher
Posts: 1625
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Anayonkar Shivalkar
Bartender
Posts: 1557
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • 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: 1557
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And Welcome to CodeRanch!
 
Winston Gutkowski
Bartender
Pie
Posts: 10527
64
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • 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
 
Campbell Ritchie
Sheriff
Pie
Posts: 50232
79
  • Mark post as helpful
  • send pies
  • 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.
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
 
Julian Meber
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

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

Thank you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic