H
Heribert500
Ambitioniertes Mitglied
- 1
Hi Leute,
habe einen Code zum importieren einer csv in meine DB.
Funktioniert perfekt Aber :
die csv datei hat immer ein Kopfzeile.
Was muss ich änder um die csv ohne Kopfzeile zu importieren ??
Bestn Dank für eure Tipps
heribert500
habe einen Code zum importieren einer csv in meine DB.
Funktioniert perfekt Aber :
die csv datei hat immer ein Kopfzeile.
Was muss ich änder um die csv ohne Kopfzeile zu importieren ??
Bestn Dank für eure Tipps
heribert500
Code:
String line = "";
//
try {
while ((line = buffer.readLine())!= null) {
String[] str = line.split(";",17);
String nr = str[0].toString();
String datum = str[1].toString();
String txt2= str[2].toString();
String txt3= str[3].toString();
String txt4= str[4].toString();
String txt5= str[5].toString();
String txt6 = str[6].toString();
String txt7= str[7].toString();
String txt8= str[7].toString();
String txt9= str[9].toString();
String txt10= str[10].toString();
String txt11= str[13].toString();
//contentValues.put("rid", nr);
contentValues.put("rdatum", datum);
contentValues.put("test1", txt2);
contentValues.put("rtest2", txt3);
contentValues.put("rfrei1", txt4);
contentValues.put("rfrei2", txt5);
contentValues.put("rfrei3", txt6);
contentValues.put("rfrei4", txt7);
contentValues.put("rfrei5", txt8);
contentValues.put("rfrei6", txt9);
contentValues.put("rfrei7", txt10);
contentValues.put("rfrei10", txt11);
csvtodb.insert(tableName, null, contentValues);
}
//
csvtodb.setTransactionSuccessful();
csvtodb.endTransaction();
}
catch (IOException e) {
}
} catch (IOException e) {
if (csvtodb.inTransaction())
csvtodb.endTransaction();
}
}
//