You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Kevin Fonner <fo...@greenfern.com> on 2001/05/14 23:16:24 UTC
resultset Question
I want to grab just the first record in a Query of my database. I thought that this would be pretty simple???
Acording to my books they said that after executing...
resultSet = statement.executeQuery("SELECT * FROM userfolders WHERE username=\'" + userName + "\'");
That resultset would contain the first record. But I can't seem to grab the data. Below is a sample of my code that I think pertains to my problem. If anybody has any ideas I would appreciate them
resultSet = statement.executeQuery("SELECT * FROM userfolders WHERE username=\'" + userName + "\'");
dFolder = resultSet.getString("folder");
dModule = resultSet.getString("dmod");
dModulePath = resultSet.getString("dmod_path");
Thanks,
Kevin
Re: resultset Question
Posted by Manish <mp...@paycom.net>.
Kevin Fonner wrote:
> I want to grab just the first record in a Query of my database. I
> thought that this would be pretty simple???
>
> Acording to my books they said that after executing...
>
> /resultSet = statement.executeQuery("SELECT * FROM userfolders WHERE
> username=\'" + userName + "\'");/
>
> That resultset would contain the first record. But I can't seem to
> grab the data. Below is a sample of my code that I think pertains to
> my problem. If anybody has any ideas I would appreciate them
>
> resultSet = statement.executeQuery("SELECT * FROM userfolders WHERE
> username=\'" + userName + "\'");
> dFolder = resultSet.getString("folder");
> dModule = resultSet.getString("dmod");
> dModulePath = resultSet.getString("dmod_path");
>
>
>
> Thanks,
>
> Kevin
>
Kevin,
" resultset would contain the first record" would contain the first
record is not true... you have to do
while (rs.next()) {
//do Something
}
This might help
Thanks
--
Manish Poddar
Software Engineer
Paycom.net