2011-09-28 14 views
1

私はアンドロイドカレンダーデータベースにクエリを行い、特定の 'iCalGUID'のイベントを探しています。ここ android.database.sqlite.SQLiteExceptionのSqlエラー:認識されないトークン

は、私が使用しているクエリです

final Cursor cursor = resolver.query(uri.getCalendarUri(), 
         null, "events.iCalGUID=" + uid, null, null); 

現在のuidが0804eaa1-3472-43df-96c2-af73ae5c31ab

である。しかし、このクエリ

android.database.sqlite.SQLiteException: unrecognized token: "0804eaa1": , 
while compiling: SELECT originalEvent, visibility, rrule, hide_declined, reminder_type, hasAlarm, 
description AS suggest_text_2, rdate, transparency, timezone, dtstart, _sync_time, hasAttendeeData, 
commentsUri, description, reminder_duration, htmlUri, _sync_account, _sync_version, hasExtendedProperties, 
last_update_time, eventLocation, dtend, allDay, organizer, sync_source, deleted, url, originalInstanceTime, alerts_vibrate, importance, selfAttendeeStatus, eventTimezone, ownerAccount, _sync_account_type, lastDate, guestsCanModify, guestsCanSeeGuests, exrule, selected, title, _id, _sync_id, alerts_ringtone, calendar_id, access_level, _sync_local_id, title AS suggest_text_1, originalAllDay, iCalGUID, _sync_dirty, duration, parentID, color, 
guestsCanInviteOthers, 
exdate, eventStatus FROM view_events WHERE (1) 
AND (events.iCalGUID=0804eaa1-3472-43df-96c2-af73ae5c31ab) 
を実行しながら、私は例外を取得しています

どのように私はアンドロイドでこれを行うことができます ありがとうございました。

答えて

1

これを試してみてください:

final Cursor cursor = resolver.query(uri.getCalendarUri(), 
         null, "events.iCalGUID=\"" + uid + "\"", null, null); 
+0

感謝を。できます。あなたの助けをお願いします。今、私はエラー列dosen'tが存在しています。そこでevents.iCalGUIDをview_events.iCalGUIDに変更しました。それはイベント列iCalGUIDを照会する正しい方法ですか? – Zach

+0

テーブルによって異なりますが、フォーマットは 'yourtablename.yourcolumname = ...'でなければなりません – Caner

+0

私はアンドロイドのデフォルトカレンダーデータベースを使用しています – Zach

関連する問題