private static final String dbname="student.db";
private static final String tblname="detail";
private static final String c1="uname";
private static final String c2="id";
private static final String c3="pass";
private static final String c4="add";
private static final String c5="gender";
private static final String c6="sequrity";
private static final String c7="answer";
public Databasehelper(Context context)
{
super(context, dbname, null, 1);
}
@Override
public void onCreate(SQLiteDatabase db)
{
String q= "create table "+tblname+"("
+c1+" varchar(10),"
+c2+" varchar(20),"
+c3+" varchar(10),"
+c4+" varchar(100),"
+c5+" varchar(10),"
+c6+" varchar(100),"
+c7+" varchar(10))";
db.execSQL(q);
}
在create table中的上述编码中定义Error
答案 0 :(得分:0)
您可以使用此
更新查询"create table "+tblname+"("+c1+" TEXT, "+c2+" TEXT, "+c3+" TEXT, "+c4+" TEXT, "+c5+" TEXT, "+c6+" TEXT, "+c7+" TEXT)";
在SQLite中,TEXT与VARCHAR相同,您可以使用TEXT as this answer。
您还可以查看常见问题的sqlite here
答案 1 :(得分:0)
for i in f1(txt):
print(i)
是sqlite keyword。因此,它不能用作标识符,例如列名。
将该列重命名为非关键字。