This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Having trouble with the SQL code - not sure if this is right can anyone help me out.Do I have to make another class? Code------ public void deleteRecord(){ guestLastName = txtLastName.getText(); guestFirstName = txtFirstName.getText(); guestEmail =txtEmail.getText(); guestStreetAddress =txtStreetAddress.getText(); guestCity =txtCity.getText(); guestState = txtState.getText(); guestZip =txtZip.getText(); guestHPhone = txtHPhone.getText(); guestWPhone = txtWPhone.getText(); guestCell = txtCell.getText(); guestFax = txtFax.getText(); guestEmployer = txtEmployer.getText(); guestMisc = txtMisc.getText();
try{ SQL = "Delete From AddressBook Where LastName = ('"+guestLastName+"','"+guestFirstName ','"+guestEmail+"','"+guestStreetAddress+"','"+ "','"+guestState+"','"+guestZip+"','"+guestHPhone+"','"+ guestWPhone+"','"+guestCell+"','"+guestFax+"','"+ guestEmployer+"','"+guestMisc+"');"; }catch(Exception e){ System.out.println("Fail to Load JDBC?ODBC driver."); }}}
Thomas Paul
mister krabs
Ranch Hand
Joined: May 05, 2000
Posts: 13974
posted
0
A normal SQL delete statement looks like this:
delete from bartender where last_name = "Paul"
I have no idea why you have a try..catch in there as all you are doing is creating a String.