java - Data from Sql Database to an Array -
i put data sql database in array
here code array:
opendb(); cursor c = mydb.getspalte(); while (!c.isafterlast()) { s1nint[i] = c.getint(1); i++; c.movetonext(); } c.close(); closedb();
and here code getspalte();
method:
public cursor getspalte() { string where= null; cursor c = db.query(true, database_table, key_kaloa, where, null, null, null, null, null); if (c != null) { c.movetofirst(); } return c; }
and if run these exception:
06-27 13:34:01.021: e/cursorwindow(24334): failed read row 0, column 1 cursorwindow has 1 rows, 1 columns.
now got these command exception:
number[] series2numbers = {/*s1nint[i-6],s1nint[i-5],s1nint[i-4],s1nint[i-3],s1nint[i- 2],s1nint[i-1],*/s1nint[i]};
this exception this:
graph.onstart() line: 75 graph(fragment).performstart() line: 1801 fragmentmanagerimpl.movetostate(fragment, int, int, int, boolean) line: 937 fragmentmanagerimpl.movetostate(int, int, int, boolean) line: 1106 backstackrecord.run() line: 690 fragmentmanagerimpl.execpendingactions() line: 1571 fragmentmanagerimpl$1.run() line: 447 handler.handlecallback(message) line: 733
the cursor starts @ 0 , must moved first row before accessing data:
while(c.movetonext()) { s1nint[i] = c.getint(1); i++; }
Comments
Post a Comment