DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Lim Wing Hoe Guest

    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
    ---------------------------------------------------------------





  2. #2
    alberto Guest

    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
    >---------------------------------------------------------------
    >
    >
    >
    >



  3. #3
    Paul Clapham Guest

    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?
    > --





Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


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


Sponsored Links