在我的项目中,我需要查询一个 id(由用户输入)是否存在,如果存在则显示“一切就绪”,否则显示“不存在数据”
请帮助我...在此先感谢。
try
{
stmt = con.createStatement();
rs = stmt.executeQuery("select accno from newCatalogue");
while(rs.next())
{
int i = rs.getInt("accno");
if(accno.equals(i))
{
out.println("got it");
}
else
{
out.println("no....!");
}
}
}
catch (Exception e)
{
e.printStackTrace();
}