📜  在 servlet 中发现重复数据 - 无论代码示例

📅  最后修改于: 2022-03-11 14:59:53.360000             🧑  作者: Mango

代码示例1
{
    String userName = request.getParameter("uname");
        String contact = request.getParameter("contact");

        //code for DB Connection
        Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
        Connection con = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databasename=sushil;user=sa; password=MultiMetal");

        Statement st = con.createStatement();
        st.executeUpdate("insert into tblUser (UserName, Contact) values('" + userName + "','" + contact + "')");

        request.getRequestDispatcher("Welcome.html").forward(request, response);