📄 verify.java
字号:
/*
* Created on 2006-9-23
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package com.skyhawk.hellen;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.skyhawk.db.ConnectionFactory;
import com.skyhawk.db.DatabaseUtils;
/**
* @author Administrator
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class Verify {
public String verify(String username,String pw){
ConnectionFactory connection=null;
Connection conn=null;
connection=new ConnectionFactory();
System.out.println("stm");
conn=ConnectionFactory.getConnection();
System.out.println("stm++++++++");
Statement stm=null;
ResultSet rs=null;
boolean boo=false;
String pass=pw;
System.out.println(pass);
String b2=null;
try {
stm=conn.createStatement();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
rs=stm.executeQuery("select * from O_myinfo1 where empid='"+username+"'and password='"+pw+"'");
if(rs.next()){
String b1=rs.getString("empid");
b2=rs.getString("name");
}
else{
System.out.println("sorry! the user is hava");
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally{
DatabaseUtils.closeObject(rs,stm,conn);
}
return b2;
}
public static void main(String[] args) {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -