2012-01-02 8 views
-2

イムは、AndroidでのSQLiteでデータベースを作成すると、いくつかの問題を抱えて...ここで私は、キーをinitiliazeない:そのような表のSQLite

public final String KEY_ROWID = "_id"; 
public final String KEY_CategoryId = "CategoryId"; 
public final String KEY_DealerAddress = "DealerAddress"; 
public final String KEY_DealerCity = "DealerCity"; 
public final String KEY_DealerCountry = "DealerCountry"; 
public final String KEY_DealerLatitude = "DealerLatitude"; 
public final String KEY_DealerLongitude = "DealerLongitude"; 
public final String KEY_DealerName = "DealerName"; 
public final String KEY_DealerWeb = "DealerWeb"; 
public final String KEY_DealerPhone = "DealerPhone"; 
public final String KEY_DealerZip = "DealerZip"; 
public final String KEY_Description = "Description"; 
public final String KEY_EndDate = "EndDate"; 
public final String KEY_EndTime = "EndTime"; 
public final String KEY_Id = "Id"; 
public final String KEY_Name = "Name"; 
public final String KEY_PriceBefore = "PriceBefore"; 
public final String KEY_PriceNow = "PriceNow"; 
public final String KEY_SavingInPercent = "SavingInPercent"; 
public final String KEY_StartDate = "StartDate"; 
public final String KEY_StartTime = "StartTime"; 
private final String TAG = "DataBase"; 

private final String DATABASE_NAME = "DealFinders"; 
private final String DATABASE_TABLE = "Favorites"; 
private final int DATABASE_VERSION = 1; 
private final String DATABASE_CREATE = 
    "create table titles (_id integer primary key autoincrement," + 
    "CategoryId text not null," 
    + "DealerAddress text not null, DealerCity text not null, DealerCountry text not null, " + 
    "DealerLatitude text not null, DealerLongitude text not null, DealerName text not null," + 
    "DealerWeb text not null, DealerPhone text not null,Description text not null," + 
    "EndDate text not null,EndTime text not null,Id text not null,Name text not null," + 
    "PriceBefore text not null, PriceNow text not null, SavingInPercent text not null, " + 
    "StartDate text not null, StartTime text not null);"; 

、残りはofcourseの一部の入力が変化して、このhttp://www.devx.com/wireless/Article/40842/1954ようなものです。しかし、それはそのようなテーブルを与え続けていますか?私はテーブル名を変更しようとしましたが、それは助けになりませんでした..

私は問題が何をすべきか分かりませんか?チュートリアルを試してみたところ、うまくいきましたが、今はいくつかの問題を抱えていますか?何か案は??

データベースに値を挿入するときに問題がある:

id = db.insertTitle(
         "nej","nej","nej","nej","nej","nej","nej","nej","nej","nej", 
         "nej","nej","nej","nej","nej","nej","nej","nej", 
         "C# 2008 Programmer's Reference", 
         "Wrox"); 

エラーは次のとおりです。

01-02 20:18:51.512: E/Database(15601): android.database.sqlite.SQLiteException: no such table: 
favorites: , while compiling: INSERT INTO favorites(DealerPhone, Description, DealerCity, 
PriceNow, DealerAddress, SavingInPercent, DealerCountry, PriceBefore, DealerName, Name, 
DealerWeb, EndDate, DealerLongitude, DealerLatitude, CategoryId, StartDate, Id, EndTime, 
StartTime, DealerZip) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); 
+0

例外を返す文を掲示できますか?あなたのコードには十分な情報が含まれていません... –

+0

私はどこにエラーが表示され、ログの猫からエラーが表示されます..これは良い意味を与えることを願って... – Mustii1989

+0

私はこの質問をd​​ownvotingし、 「あまりにもローカライズされた」として閉じられた。あなた自身が答えることができない質問については、Stack Overflowを使用してください。あなたがチュートリアルをデバッグするのを助けるためのプラットフォームではありません –

答えて

2

まあ、実行文は

INSERT INTO favorites ... 

であるあなたはおそらくしたいのに対し

私はどちらかあなたの DATABASE_TABLEDATABASE_CREATE定数が間違っていると推測しているは

...あなたは

+0

いいえ、私は実際に間違いが何であるかを知りませんでした。あなたがそれを変更するチュートリアルからのもののようなタイトル..あなたはそれを行うためにあなたの電話からアプリケーションを削除する必要があります.. SOOO heelpfullされていただきありがとうございます。 – Mustii1989

+0

それは正常です。実際にあなたのデータベースにいくつかのアップグレードを行い、あなたがパッチをリリースしたとき、そのアップグレードを管理して古いテーブルを変更するか、古いアプリケーションバージョンでクラッシュします – StErMi

+0

これで多くの作業があるようです。 ..ありがとう – Mustii1989

0

はい、そのかなり明確かかわらず、自分でこれを見つけたはずです。あなたはテーブルのお気に入りに値を挿入しようとしていますが、create Stringにはタイルがあります。

そのいずれかです。多分、あなたは犠牲者である激しいコピー/ペーストです。

関連する問題