java JDBC statement question?
I have changed it slightly now. For this table, multiple rows are going to be updated and the values are got from an object i have created. This is what i have now
Code:
try
{
con = DatabaseUtils.connect(DRIVER, URL);
String sql = "INSERT INTO tblResult (Competitor_ID, Event_ID, results) " +
"SELECT c.ID, e.ID, ? " +
"FROM tblCompetitor as c, tblEvent as e " +
"WHERE c.Last_Name = ? and e.Event_Name = ?";
ps = con.prepareStatement(sql);
for(int i = 0; i < update2.length; i++)
{
ps.setString(1, update2[i].getTime());
ps.setString(2, update2[i].getLastname());
ps.setString(3, eveType2);
}
ps.executeUpdate();
}
The problem i am having is that no data is getting inserted into this table. I am not sure if i have to setString in order of the column names or in order of my ? Can anyone see any mistakes?
|