SQLiteException:近"引用":语法错误 [英] SQLiteException: near "references": syntax error

查看:212
本文介绍了SQLiteException:近"引用":语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

String CREATE_ASSIGNMENTS_TABLE= "create table "
        + ASSIGNMENTS + "(" + TITLE
        + " text not null, " + DESCRIPTION
        + " text not null, " + REFERENCES + " text not null );";

这是我创建表查询到SQLite中创建一个表。

This is my create table query to create a table in SQLite.

我有三个字段(标题,描述,参照)。所有的文本字段。但是,当我执行code,我得到了以下异常:

I have three fields (title,description,reference). All are text fields. But when I execute the code, I get the following Exception:

android.database.sqlite.SQLiteException: near "references": syntax error (code 1): , while compiling: create table ASSIGNMENTS(TITLE text not null, DESCRIPTION text not null, REFERENCES text not null);

这是指向一个错误的参考字段。但我无法找到任何语法的错误。请帮我在这件事情。

It is pointing to an error in the REFERENCES field. But I couldn't find any syntax error there. Please help me out in this matter.

推荐答案

参考是的关键字在SQL语法。要么更改列名或引用它的反引号:

REFERENCES is a keyword in SQL syntax. Either change the column name or quote it in backticks:

`REFERENCES`

这篇关于SQLiteException:近"引用":语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆