首页>代码>基于jsp,javaBean,servlet开发的java web教务后台管理系统>/TeacgersManagement/src/com/tcd/service/userService.java
package com.tcd.service; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import com.tcd.model.userTable; public class userService { /** * ��֤�û��Ƿ�Ϸ� */ private Connection conn; private PreparedStatement pstmt; public userService(){ conn = new com.tcd.conn.conn().getCon(); } public boolean valiUser(userTable user){ try { pstmt = conn.prepareStatement ("select * from usertable where username=? and password=?"); pstmt.setString(1, user.getUsername()); pstmt.setString(2, user.getPassword()); ResultSet rs = pstmt.executeQuery(); if(rs.next()){ return true; }else{ return false; } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); return false; } } /** * �û�ע�ᣬ��¼�ɹ�����true����¼ʧ�ܷ���false * @param user * @return */ public boolean addUser(userTable user){ try { pstmt =conn.prepareStatement("insert into userTable (username,password) value(?,?)"); pstmt.setString(1, user.getUsername()); pstmt.setString(2, user.getPassword()); pstmt.executeUpdate(); return true; } catch (SQLException e) { e.printStackTrace(); return false; } } }

WenMeng LV9
2024年12月2日
PISCESPLUS LV5
2024年9月3日
仙女山的月亮 LV2
2024年5月22日
微信网友_6790506018131968 LV1
2024年1月3日
asddwh LV13
2023年12月26日
17693282606 LV12
2023年12月20日
李朝磊 LV18
2023年12月7日
qiangmin1223 LV12
2023年4月24日
wwfl02 LV3
2022年12月5日
485415187 LV6
2022年11月20日