can u help me

From: JACOB SIBI <js022(at)gre(dot)ac(dot)uk>
To: pgsql-bugs(at)postgresql(dot)org
Subject: can u help me
Date: 2001-04-02 18:49:39
Message-ID: 3AC8C9C3.19F5C545@gre.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)hotmail(dot)com

jacob

Browse pgsql-bugs by date

  From Date Subject
Next Message Stephen Ramsay 2001-04-02 20:13:43 psql segmentation fault
Previous Message Lamar Owen 2001-04-02 17:20:43 Re: Re: Indexes vs indices