public static final String Create_Database2= "CREATE TABLE " + Table_Name2 + "("
+ play20 + "INTEGER PRIMARY KEY, "
+ play1 + " LONG, "
+ play2 + " LONG, "
+ play3 + " INTEGER, "
+ play4 + " INTEGER, "
+ play5 + " LONG, "
+ play6 + " TEXT, "
+ play7 + " TEXT, "
+ play8 + " TEXT, "
+ play9 + " TEXT, "
+ play10 + " TEXT, "
+ play11 + " INTEGER, "
+ play12 + " INTEGER, "
+ play13 + " INTEGER, "
+ play14 + " INTEGER, "
+ play15 + " INTEGER, "
+ play16 + " INTEGER, "
+ play17 + " TEXT, "
+ play18 + " INTEGER, "
+ play19 + " TEXT"
+ ") ";
我正在使用上述方法创建一个表?我正在使用此方法在此表中插入值;
public void fetchplaylist() throws IOException
{
this.open();
ContentValues values2 = new ContentValues();
String csvFilename2 = "/mnt/sdcard/playlist.csv";
CSVReader csvReader2 = new CSVReader(new FileReader(csvFilename2));
String Row[] = null;
while((Row = csvReader2.readNext()) != null) {
st1=Row[0];
st2=Row[1];
st3=Row[2];
st4=Row[3];
st5=Row[4];
st6=Row[5];
st7=Row[6];
st8=Row[7];
st9=Row[8];
st10=Row[9];
st11=Row[10];
st12=Row[11];
st13=Row[12];
st14=Row[13];
st15=Row[15];
st16=Row[16];
st17=Row[17];
st18=Row[18];
st19=Row[19];
values2.put(DatabaseHandler.play1,st1);
values2.put(DatabaseHandler.play2,st2);
values2.put(DatabaseHandler.play3,st3);
values2.put(DatabaseHandler.play4,st4);
values2.put(DatabaseHandler.play5,st5);
values2.put(DatabaseHandler.play6,st6);
values2.put(DatabaseHandler.play7,st7);
values2.put(DatabaseHandler.play8,st8);
values2.put(DatabaseHandler.play9,st9);
values2.put(DatabaseHandler.play10,st10);
values2.put(DatabaseHandler.play11,st11);
values2.put(DatabaseHandler.play12,st12);
values2.put(DatabaseHandler.play13,st13);
values2.put(DatabaseHandler.play14,st14);
values2.put(DatabaseHandler.play15,st15);
values2.put(DatabaseHandler.play16,st16);
values2.put(DatabaseHandler.play17,st17);
values2.put(DatabaseHandler.play18,st18);
values2.put(DatabaseHandler.play19,st19);
database.insert(DatabaseHandler.Table_Name2, null, values2); }
但我在我的 logcat 中设置 sqlite 错误代码 19 约束失败我在这里做什么?我无法理解这一点,请有人帮我理解这一点