android android.database.sqlite.SQLiteException中的Sql错误:无法识别的令牌

时间:2011-09-28 12:04:26

标签: android sqlite calendar icalendar

我正在查询android日历数据库并查找具有特定“iCalGUID”的事件。

这是我正在使用的查询

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)

我怎么能在android中做到这一点 感谢。

1 个答案:

答案 0 :(得分:1)

试试这个:

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