SQL Server deletes the data and removes the page's information from the database.
<TableBorder=1px style="width:500px;height:200px;text-Align:center;margin:0Auto> <TR Style="Background:red"> <Td>Number</Td> <Td>Title</Td> <Td>Price</Td> <Td>Favorite Degree</Td> <Td>Author</Td> <Td>Delete</Td> <Td>Modify</Td> </Tr> <% //Reference Connection database method SQL Server sq=new SQL Server (); //Get database connection Connection con=sq.getconnection (); //write SQL statement String SQL="Select * fromDog "; //get Database object Operations Statement St=con.createstatement (); //get the results of the query ResultSet RS=st.executequery (SQL); while(Rs.Next()){ %> <Tr> <Td> <%Out.Print(Rs.getint (1)+"\ t");%></Td> <Td> <%Out.Print(Rs.getstring (2)+"\ t");%></Td> <Td> <%Out.Print(Rs.getint (3)+"\ t");%></Td> <Td> <%Out.Print(Rs.getint (4)+"%"+"\ t");%></Td> <Td> <%Out.println (Rs.getstring (5)+"\ t");%></Td> <Td> <a href="Delect.jsp?id=<%Out.Print(Rs.getint (1)+"\ t");%>">Delete</A></Td> <Td> <a href="Update. jsp?id=<%Out.Print(Rs.getint (1)+"\ t");%>">Modify</A></Td> </Tr><% } //Frees Resource Sq. Shifang (Rs,st,con); %> </Table>
<%@ Page Language="Java" Import="Java.util.*"Pageencoding="UTF-8"%><%@pageImport="Jdbc.sqlserver"%><%@pageImport="Java.sql.Connection"%><%@pageImport="Java.sql.PreparedStatement"%><%String ID=request.getparameter ("id"); ID=New String (Id.getbytes ("ISO-8859-1")," utf-8"); //Reference Connection database method SQL Server sq=new SQL Server (); //Get database connection Connection con=sq.getconnection (); //write SQL statement String SQL="Delete fromDogwhereId="+Id+ ""; //Get database Operations Object PreparedStatement St=con.preparestatement (SQL); //get the results of the queryif(St.executeupdate ()>0){%> <Script type="text/JavaScript>Alert ("Delete succeeded"); Location="showlog.jsp"; </Script> <% }Else{ %> <Script type="text/JavaScript>Alert ("Delete failed"); Location="showlog.jsp"; </Script> <% } %>
SQL Server deletes the data