String table="tableName"; String tableValue="12"; int result=stmt.executeUpdate(Insert into '"+table+"' values('"+tableValue+"')"); is this statement correct !!!???
[This message has been edited by vikas de (edited March 30, 2001).]
Frank Carver
Sheriff
Joined: Jan 07, 1999
Posts: 6913
posted
0
It will be almost correct if your table only has a single column of a text type. You should remove the quotes from the table name, first, though. As with "select" statements, it's almost always better to specify the column names: int result = stmt.executeUpdate("insert into " + table + " (colname) values('" + tableValue + "')" ); If your column has a numeric type, you should not put quotes on the value either: int result = stmt.executeUpdate("insert into " + table + " (colname) values(" + tableValue + ")" );