Check if record exist in database?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Check if record exist in database?

Hybrid View

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





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


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center