📄 select.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -