I know this should be simpel, and I probably look directly at the problem, but get stuck again and need the help of a code guru.
im also trying to take one row from a column in jdbc and put them in an array.
I do it as follows:
public void fillContactList()
{
createConnection();
try
{
Statement stmt = conn.createStatement();
ResultSet namesList = stmt.executeQuery("SELECT name FROM Users");
try
{
while (namesList.next())
{
contactListNames[1] = namesList.getString(1);
System.out.println("" + contactListNames[1]);
}
}
catch(SQLException q)
{
}
conn.commit();
stmt.close();
conn.close();
}
catch(SQLException e)
{
}
creatConnection is an already defined method that does what it explicitly does. i creat is my result set while theres another, I store the row of this column in an array. then print it for a good grade. make sure he's there too.
the problem is that its storing the entire column in contactListNames [1]
I wanted him to save the row of column 1 in [1]
then column 1 row 2 in [2]
, . , . ?
p.s ive api, jsut can not , .