can u help me - Mailing list pgsql-bugs

From JACOB SIBI
Subject can u help me
Date
Msg-id 3AC8C9C3.19F5C545@gre.ac.uk
Whole thread Raw
List pgsql-bugs
Hi,
I have a probelm with my JDBC coding. Iam using a Java  swing interface
to input data. It reads in studentID from the textField and should
output the average.The code compliles well. But i get the average as 0,
with exceptions as detailed below.

The error I get is
java.sql..SQLException:[Microsoft] [ODBC Driver Manger]  Invalid cursor
state.


This is the code that creates the error.

 public void FindAverageStudent()
           {
            int marksPE2=0;
            int marksSE1=0;
            int marksEA=0;
            int average=0;
            int TotalMarks=0;
            int StudID=Integer.parseInt(StudentIDField.getText());

            try
            {
            Statement stmt = connection.createStatement();
            ResultSet rs = stmt.executeQuery(
            "SELECT * FROM Student2 " + " WHERE Student_ID = '" +
StudentIDField.getText() + "'");


              marksPE2=rs.getInt(4);
              marksSE1=rs.getInt(5);
              marksEA=rs.getInt(6);
              TotalMarks=marksPE2+marksSE1+marksEA;
              average=TotalMarks/3;
              connection.close();
            }
            catch(SQLException sqlex)
            {
            sqlex.printStackTrace();
            }
            Area1.append("The average marks of the student is "+
average);
          }



Hope to hear from you,


My emailid is jacobspj@hotmail.com

jacob

pgsql-bugs by date:

Previous
From: Lonnie Cumberland
Date:
Subject: PostgreSQL tcp connection
Next
From: pgsql-bugs@postgresql.org
Date:
Subject: Table constraint ordering disrupted by pg_dump