开发者

sql lite, android - copy record into the same table

I am trying to copy a record from a sql lite database within a android application and then insert that same record into the same table but with two different ids in the first two columns. any ideas?

    SQLiteDatabase db = dbs.getReadableDatabase();
        String SQL = "SELECT * FROM table_1 a " +
                "join table_2 b on a.ID = b.ID " +
                "where table1_Id = '"+Id+"' And" +
                "table_2_ID = 'one'"; 
        Cursor cursor2 = db.rawQuery(SQL, null); 
        startManagingCursor(cursor2);
        int m = cursor2.getColumnCount();
        try{
           while (cursor2.moveToNext()) {
             for(int i=0; i<m; i++){
                String id1 = cursor2.getStr开发者_JAVA百科ing(i);
             }
           }
         }
         catch(Exception e){}


try {
  while (cursor2.moveToNext()) {
    dbs.ad(Id, Id, cursor2.getString(3), "",
           cursor2.getString(5), cursor2.getString(6), cursor2.getString(7), 
           "", "");
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜