hi,
This is one of the column in my database table.
ID is primary column
CITY ID
Colway
Colway ---row 2 00232
Colway
Colway
Colway
Colway 1
ColPOP
Colway 2
ColPOP
Colway 2
ColPOP
ColPOP
Colway 1
Colway 3
Colway 1---row 15 00275
Colway
Colway 1
Colway 2
ColPOP
Colway 1
Colway 1
Colway
Colway
Colway
Colway
Shakti Nagar HLR
i want to display only 2nd and 15th row values
how can i write jdbc code to retrieve it
i took two result sets to retrieve it...and im differenciating by primary key ID
iam not getting any idea of doing with single result set
can anybody tell me easy code for it..
This is one of the column in my database table.
ID is primary column
CITY ID
Colway
Colway ---row 2 00232
Colway
Colway
Colway
Colway 1
ColPOP
Colway 2
ColPOP
Colway 2
ColPOP
ColPOP
Colway 1
Colway 3
Colway 1---row 15 00275
Colway
Colway 1
Colway 2
ColPOP
Colway 1
Colway 1
Colway
Colway
Colway
Colway
Shakti Nagar HLR
i want to display only 2nd and 15th row values
how can i write jdbc code to retrieve it
i took two result sets to retrieve it...and im differenciating by primary key ID
iam not getting any idea of doing with single result set
can anybody tell me easy code for it..
Code:
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
Statement stmt1 = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet rs=stmt.executeQuery("select * from CITY where city='Colway'and ID='00232'");
ResultSet rs1=stmt1.executeQuery("select * from CITY where city='Colway 1'and ID='00275'");
while(rs.next())
{
System.out.println("connecting to database");
String ct=rs.getString("CITY");
System.out.println(ct);
break;
}
while(rs1.next())
{
String ct=rs1.getString("CITY");
System.out.println(ct);
break;
}
Comment