Forums Register Login

need help with array

+Pie Number of slices to send: Send
hey
can somebody tell me how to print result from my array?
This is my code and i don't know what's wrong...



public void connection() throws ClassNotFoundException, SQLException
{
try
{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con= DriverManager.getConnection("jdbcdbc:test");
Statement s= con.createStatement();
String query = "SELECT * from table";
ResultSet rs = s.executeQuery(query);


while (rs.next())
{
for (int i=0; i<0; i++)
{
question[i]= rs.getString("columnQustion");
answer1[i]=rs.getString("column1");
answer2[i]=rs.getString("column2");
answer3[i]=rs.getString("column3");
answer4[i]=rs.getString("column4");

}

}
setQandA();
rs.close();
s.close();
con.close();
}
catch (ClassNotFoundException e)
{
e.printStackTrace();
}
catch (SQLException e)
{

}
}
public void setQandA();
{
int i=0;
label1.setText("question number:" + " "+ (i+1));
labelQuestion.setText(question[i]); //
radioButton1.setText(answer1[i]); // when i comment those lines program running
radioButton1.setText(answer2[i]); // otherwise not
radioButton1.setText(answer3[i]); //
radioButton1.setText(answer4[i]); //
}


thanks
+Pie Number of slices to send: Send
i am not clear on question but this approach you can use

+Pie Number of slices to send: Send
does something look odd here?

for (int i=0; i<0; i++)


[edit]
another one for the ignore list

http://www.java-forums.org/awt-swing/29688-need-help-array.html
+Pie Number of slices to send: Send
Welcome to the Ranch

As Michael Dunn has implied, it is discourteous to ask the same question in two places without informing everybody.
+Pie Number of slices to send: Send
Please UseCodeTags when posting code or configuration. Unformatted code and configuration is unnecessarily difficult to read. You can edit your post by using the button. Thanks, and welcome to JavaRanch!
Think of how stupid the average person is. And how half of them are stupider than that. But who reads this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1110 times.
Similar Threads
Run time checkbox values
Can't Update Record ?
Help with java input file
Can't Update Record ?
Help with java input file
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 09:38:32.