Check if record exist in database?
I'm connecting to mysql server using Java.
In VB, I once used a condition
if (rs.BOF=true and rs.EOF=true) then
// display error message that the recordset stated by the SQL String
doesn't exist
How do I check if the resultset exist in Java?
--
Best Regards,
Wing Hoe
---------------------------------------------------------------
ICQ: 2213281
Email: winghoe@hotmail.com
www: http://pwp.maxis.net.my/winghoe
---------------------------------------------------------------
Re: Check if record exist in database?
public void executeQuery(String query) {
if (connection == null || statement == null) {
System.err.println("Message Error!!");
return;
}
"Lim Wing Hoe" <winghoe@hotmail.com> wrote:
>I'm connecting to mysql server using Java.
>
>In VB, I once used a condition
>
>if (rs.BOF=true and rs.EOF=true) then
> // display error message that the recordset stated by the SQL String
>doesn't exist
>
>How do I check if the resultset exist in Java?
>--
>
>
>
>Best Regards,
>Wing Hoe
>---------------------------------------------------------------
>ICQ: 2213281
>Email: winghoe@hotmail.com
>www: http://pwp.maxis.net.my/winghoe
>---------------------------------------------------------------
>
>
>
>
Re: Check if record exist in database?
The resultset will always exist. If you are asking how to check if it
contains any records, you just try to read the first record. If it isn't
there, then the resultset is empty.
Lim Wing Hoe <winghoe@hotmail.com> wrote in message
news:39f7badc@news.devx.com...
> I'm connecting to mysql server using Java.
>
> In VB, I once used a condition
>
> if (rs.BOF=true and rs.EOF=true) then
> // display error message that the recordset stated by the SQL String
> doesn't exist
>
> How do I check if the resultset exist in Java?
> --