未能读取第 0 行第 3730 列
Failed to read row 0 column 3730
这是我的代码:
dbAdapterdepartamento = new DBAdapterDepartamento(new Sqlitebbdd(
getApplicationContext()));
Cursor cdept=dbAdapterdepartamento.getAllDepartamentos();
cdept.moveToFirst();
while (cdept.isAfterLast() == false) {
if (cdept.getFloat(cdept.getColumnIndex("_id")) == 0) {
String title = cdept.getString(cdept.getColumnIndex("departamento"));
Log.e("",""+title);
}
cdept.moveToNext();
}
cdept.moveToNext();
departamentoSpinnerAdapter = new SimpleCursorAdapter(this,
android.R.layout.simple_spinner_dropdown_item,
cdept,
new String[] { Tablas.ColumnDEPARTAMENTO.NOMBRE_DEPARTAMENTO },
new int[] { android.R.id.text1 },
SimpleCursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
sp2 = (Spinner) findViewById(R.id.spinner2);
sp2.setAdapter(departamentoSpinnerAdapter);
sp2.setOnItemSelectedListener(this);
游标只有28行2列,但每次都return很多列。这是错误:
Failed to read row 0, column 3730 from a CursorWindow which was 28
rows, 2 columns.
我认为你的数据库在
String title = cdept.getString(cdept.getColumnIndex("departamento"));
为了
row 0 , column departamento
保留编号 3730,实际上您的数据库 table 结构没有索引为 3730 的列
所以您在 table 值中有错误值的问题,可能是插入问题
这是我的代码:
dbAdapterdepartamento = new DBAdapterDepartamento(new Sqlitebbdd(
getApplicationContext()));
Cursor cdept=dbAdapterdepartamento.getAllDepartamentos();
cdept.moveToFirst();
while (cdept.isAfterLast() == false) {
if (cdept.getFloat(cdept.getColumnIndex("_id")) == 0) {
String title = cdept.getString(cdept.getColumnIndex("departamento"));
Log.e("",""+title);
}
cdept.moveToNext();
}
cdept.moveToNext();
departamentoSpinnerAdapter = new SimpleCursorAdapter(this,
android.R.layout.simple_spinner_dropdown_item,
cdept,
new String[] { Tablas.ColumnDEPARTAMENTO.NOMBRE_DEPARTAMENTO },
new int[] { android.R.id.text1 },
SimpleCursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
sp2 = (Spinner) findViewById(R.id.spinner2);
sp2.setAdapter(departamentoSpinnerAdapter);
sp2.setOnItemSelectedListener(this);
游标只有28行2列,但每次都return很多列。这是错误:
Failed to read row 0, column 3730 from a CursorWindow which was 28 rows, 2 columns.
我认为你的数据库在
String title = cdept.getString(cdept.getColumnIndex("departamento"));
为了
row 0 , column departamento
保留编号 3730,实际上您的数据库 table 结构没有索引为 3730 的列
所以您在 table 值中有错误值的问题,可能是插入问题