evergrean100
Technical User
I have the same results with SQL statement in my Database class file several times and was wondering if I can make it into a method?
My attempt outputs no data. Please advise.
Code:
public somemethod()
{
ResultSet results = null;
Statement statement = null;
...
//next two lines are repeated several times in different methods in this class file:
results = statement.executeQuery("select sport from typetable");
results.next();
....
My attempt outputs no data. Please advise.
Code:
public boolean mymeth()
{
try {
ResultSet results = null;
Statement statement = null;
results = statement.executeQuery("select sport from typetable");
boolean mydata = results.next();
}
catch(Exception e)
{
}
return mydata;
}
public somemethod()
{
ResultSet results = null;
Statement statement = null;
...
mymeth();
....