Results 1 to 3 of 3
  1. #1
    arunkumarinfo is offline Member
    Join Date
    Jan 2009
    Posts
    15
    Rep Power
    0

    Thumbs down How To Use This Statement In My Program

    STATEMENT IS (----------ResultSetMetaData counter=rs.getData();-----------)

    this is my program

    import java.io.*;
    import java.sql.*;
    class status
    {
    public static void main(String args[])throws IOException
    {
    String customerid=null;
    String str=null;
    Connection con =null;
    ResultSet rs =null;
    Statement st =null;
    String city="salem";
    try
    {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con=DriverManager.getConnection("jdbc:odbc:tiens") ;
    st=con.createStatement();
    str = "select customerid,count(customername) \"counter\" from customer ";
    rs =st.executeQuery(str);
    while(rs.next())
    {
    customerid=rs.getString("customerid");
    System.out.println(customerid);
    }
    rs.close();
    st.close();
    }catch(Exception e){}
    }
    }

  2. #2
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    6

    Default

    rs.getData()... i cant find this method in java5 and java6...
    you may try getMetaData() method and read
    ResultSetMetaData (Java Platform SE 6)
    or
    ResultSetMetaData (Java 2 Platform SE 5.0)

  3. #3
    JavaForever is offline Member
    Join Date
    Jan 2009
    Posts
    4
    Rep Power
    0

    Default

    Hi there can you tell me exactly what do you want to perform with this code.
    Do you want to view the result of database table.

Similar Threads

  1. unreachable statement - Java calculator program
    By V2001Gordon in forum New To Java
    Replies: 3
    Last Post: 12-13-2008, 12:57 AM
  2. If statement, please help??
    By soc86 in forum New To Java
    Replies: 5
    Last Post: 11-23-2008, 02:58 PM
  3. Help with if statement
    By carl in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 07:53 AM
  4. Statement or Prepared Statement ?
    By paty in forum JDBC
    Replies: 3
    Last Post: 08-01-2007, 04:45 PM
  5. If Statement
    By aDrizzle in forum New To Java
    Replies: 4
    Last Post: 07-08-2007, 08:55 PM

Posting Permissions

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