问题如下
public Account queryByaccount1(String account) throws SQLException {
Account acc = null;
Connection conn = this.getConnection();
PreparedStatement st = conn.prepareStatement("{call account_ExistUser(?)}");
st.setString(1, account);
ResultSet rs = st.executeQuery() ;
//怎样将rs里的数据写入acc中,下面是我写的,可是不行!请问怎么写?
while(rs.next())
{
acc.setId(rs.getInt(1));
acc.setUsername(rs.getString(2));
acc.setpwd(rs.getString(3));
}
return acc;
}
如果可以的话,给个完整的例子~~~ 谢谢了~~~~
[b]问题补充:[/b]
我看了,可是不是很明白~~
请lovewhzlq (资深架构师) 能以我这个例子写一次麽?~
`
根据用用户名account取得数据库的这条内容。