-
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?
> --
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks