java - Specific data from sqlite -


i have sqlite table contains these informations

id     nickname    status 1        john      online 2        tom       offline 3         .        online .         .        online .         .        online 

so need nicknames table which's status online , turn data string array.

i have tried didnt response anything.

class.forname("org.sqlite.jdbc");  connection connection = drivermanager.getconnection(url, username, pass); preparedstatement pst=connection.preparestatement("select nickname users status=?"); pst.setstring(1, "online");  resultset rs= pst.executequery();  stringbuilder sbnewer=new stringbuilder(); int ir=1; sbnewer.append("linestart");  while(rs.next()){     sbnewer.append(rs.getstring(ir)+"and");     ir++; } 

it seems me problem in line: sbnewer.append(rs.getstring(ir)+"and");

looking @ docs getstring states parameter column number want (note not row number seems assume). each call rs.next gets next row, want column 0 (the first 1 - nickname) entire usage of ir seems incorrect.

if remove ir variable , replace above line simply: sbnewer.append(rs.getstring(0)+"and"); want.


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -