Results 1 to 4 of 4

Thread: SQL: Returning a query into a string

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Location
    Burlington, ON, Canada
    Posts
    99

    SQL: Returning a query into a string

    I have a memo field in a Access database that I want to query and return to a string.

    I can't figure out how to do so.

    Any thoughts?

    Steve

  2. #2
    Addicted Member
    Join Date
    May 2001
    Location
    UK
    Posts
    222

    getStrng()

    Erm, you might have already tried this , but in case you haven't:

    Code:
    Statement stmt = connection.createStatement();
    ResultSet rs = stmt.executeQuery("Select memocolumn from table");
    while(rs.next()){
        String str = rs.getString(1);
        System.out.println(str);
    }
    rs.close();
    stmt.close();
    apart from wrapping it in a try catch block that should work, the memo field in Access should have the ability to be pulled out as a String...

    failing that, and i can't be certain, you might be able to use the rs.getClob(1) method, and this should return the data type of character large object...

    try and stick with the getString if you can, its a lot easier!


    Andy

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Location
    Burlington, ON, Canada
    Posts
    99
    i tried that and it didn't seem to work..i'll give it another go round

    steve

  4. #4
    Addicted Member
    Join Date
    May 2001
    Location
    UK
    Posts
    222
    have you tried the Object obj = rs.getObject(columnName)
    and then probed the obj to find out what it thinks it is?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width