> selectedName = request.getParameter("Combo Box");
>
> statement.executeUpdate("delete ID,PHONENAME from PHONE where
> ID=(select ID from PHONE WHERE PHONENAME= +selectedName ) " );
>
> I want corect code for deletind data from database(SQL);
Snippet:
private static final String SQL =
"delete ID,PHONENAME from PHONE where PHONENAME = ?";
Connection cxn = DriverManager.getConnection( dbUrl );
PreparedStatement ps = cxn.prepareStatement( SQL );
int nRows = ps.executeUpdate();
Program structure and exception handling are obviously omitted.
You should consider being more detailed and complete with your questions.

Signature
Lew
Arne Vajhøj - 21 Nov 2007 21:00 GMT
>> selectedName = request.getParameter("Combo Box");
>>
[quoted text clipped - 12 lines]
>
> Program structure and exception handling are obviously omitted.
I think I would use:
private static final String SQL = "delete from PHONE where PHONENAME = ?";
Connection cxn = DriverManager.getConnection( dbUrl );
PreparedStatement ps = cxn.prepareStatement( SQL );
ps.setString(1, selectedName);
int nRows = ps.executeUpdate();
I think you would too.
Arne
Lew - 22 Nov 2007 02:08 GMT
> I think I would use:
>
[quoted text clipped - 5 lines]
>
> I think you would too.
Crap. You're right. I should've looked at the SQL more closely.
I was careless. Sorry.

Signature
Lew