Saturday, June 30, 2012

Re: ResultSet does not have a column ID or (1)

why the resultset not return the column Information

On Saturday, 30 June 2012 12:30:32 UTC+5:30, Shilendra wrote:
I am insert the record with auto incremented ID and one field User_ID update at the time of insert as the base max id in the ID value, at insert is execute and select also but the rs dnt have the column value rs=st.executeQuery("SELECT max(ID) From Person"); int ID1=rs.getInt("ID");so the result set show the ResultSet does not have a column ID why is show?


Statement st=c.createStatement();
      rs
=st.executeQuery("SELECT max(ID)  From Person");
     
int ID1=rs.getInt("ID");
     
System.out.print("ID: " + ID1);


and update commned

String statement1 ="UPDATE Person SET User_ID='HRD'+'"+ID1+"' where ID='"+ID1+"'";
     
PreparedStatement stmt1 = c.prepareStatement(statement1);
      success
= stmt1.executeUpdate();


No comments:

Post a Comment