SQL Server deletes the data

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.