Hello can im new to Jsp and trying to delete data in a database using JSP. everything works fine except the data dose not delete I have posted the code below if any 1 can help me. Thanks
HTML Code:
<title>Delete Question


int nID1;
 if (request.getParameter("nID") == null) {

} else {
 String sQuestID = request.getParameter("nID"); 

 nID1 =  Integer.parseInt(sQuestID);

<!-- the % tag below is what is called a scriptlet tag - allows java to be embedded in the jsp -->
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>


// creates and initialises the JDBC-ODBC bridge driver
	// NB this driver is designated as "experimental" and not recommended for commercial use!

	// note that we give the name of the local directory here! --> "nas1/" segment below
	// will need changing if this page is moved!
	String sHere = getServletContext().getRealPath("/au003022/jsp/bare2/JSP-FAQ-assignment.accdb");

	// builds the connection string - makes it easier to print it for checking purposes
	String sConn = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" + sHere + ";";

// makes the connection with the database
	Connection cnJDBC = DriverManager.getConnection(sConn);

	// gets ready to send a SQL command down our connection
	Statement stJDBC = cnJDBC.createStatement();

	// Allows us to check our SQL statement and see that it is well formed
	String sSQL = "Delete FROM tblFAQ WHERE ID='" + nID1 + "';";	
	//out.print("Debug:<br />" + sSQL + "<hr />");

//ResultSet rs = stJDBC.executeUpdate(sSQL);





Last edited by shabbir; 19Dec2010 at 10:09.. Reason: Code blocks