select.java

来自「会务管理系统」· Java 代码 · 共 58 行

JAVA
58
字号
package zhuye;
import java.sql.*;
 public class select
{
  public static  Connection con;
  public static Statement st;
  //public ResultSet rs;
  
  public   void getRecor()throws SQLException
  {
  	//转载驱动程序
  	try
  	{
  	 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  	 }
  	 catch(ClassNotFoundException e)
  	 {
  	 	System.out.println(e);
  	 	System.exit(1);
  	 	}
  	 	 con=DriverManager.getConnection("jdbc:odbc:usery","sa","sa");
  	 	 st=con.createStatement();
  	 }	
  	
 
   public int select(String st1,String st2)throws SQLException
	{  int k=0;
		getRecor();
	    ResultSet rs=st.executeQuery("select * from qqq where code='"+st1+"'and password='"+st2+"'");
		 while(rs.next())
		 {
		 	 k++; 
		 }
		return k;
   }
   public int select1(String st1)throws SQLException
   	{  int b=0;
		getRecor();
	    ResultSet rs=st.executeQuery("select * from qqq where code='"+st1+"'");
		 while(rs.next())
		 {
		 	 b++; 
		 }
		return b;
   }
   public int select2(int num)throws SQLException
   {
   	int c=0;
   	getRecor();
	    ResultSet rs=st.executeQuery("select num from meetingperson where num='"+num+"'");
		 while(rs.next())
		 {
		 	 c++; 
		 }
		return c;
	}
   	
 }

⌨️ 快捷键说明

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