⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 customer.java

📁 远程电子考试系统
💻 JAVA
字号:
package fangsoft.testcenter.model;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import java.io.IOException;

public class Customer {
	public static boolean login(String userId, String password, Connection con)
			throws IOException, SQLException {

		PreparedStatement ps = null;
		ResultSet result = null;
		String pword = null;
		String sqlString = "select password " + "from customer"
				+ " where name=?";
		ps = con.prepareStatement(sqlString);
		ps.setString(1, userId);
		result = ps.executeQuery();
		if (result.next()) {
			pword = result.getString("password");
		} else
			return false;
		if (pword.equals(password))
			return true;
		else
			return false;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -