Results 1 to 4 of 4
  1. #1
    nHulk's Avatar
    nHulk is offline Member
    Join Date
    Apr 2011
    Posts
    5
    Rep Power
    0

    Thumbs up jsp Debug this error soon

    Java Code:
    try
    		{
    			Class.forName("com.mysql.jdbc.Driver").newInstance();
    			String url="jdbc:mysql://localhost/student";
    			Connection con = DriverManager.getConnection(url,"root","");
    			java.sql.Statement stmt = con.createStatement();
    			ResultSet rs=stmt.executeQuery("Select max(cid) from citizen_info");
    			while(rs.next()){
    			
    			int temp1=rs.getInt("max(cid)");
    			break;
    			}
    			
    			   temp1++;
    			  stmt.executeUpdate("insert into citizen_info values("+temp1+",'"+uname+"','"+pass+"','"+addr+"',"+age+",'"+date1+"','"+gender+"','"+qualif+"','"+mob+"','"+email+"','"+proof+"')");
    			  stmt.executeUpdate("insert into login values("+appln+",'"+uname+"','"+pass+"','"+email+"')");
    			  out.println("You are successfully registered ");
    			
    			
    			con.close();
    		}
    		catch(Exception e)
    		{
    		out.println("Error "+e);
    		}
    		
      
    		}
    		%>


    problem is its giving error at temp1 ... it not getting incremented ...help me out
    Last edited by nHulk; 04-27-2011 at 12:54 PM. Reason: to be active

  2. #2
    go4soumya is offline Member
    Join Date
    Oct 2010
    Posts
    32
    Rep Power
    0

    Default error in temp1

    hi nHulk,

    Try this...

    Java Code:
    int temp1=rs.getInt(1); // here 1 is the column index
    Good luck.

  3. #3
    nHulk's Avatar
    nHulk is offline Member
    Join Date
    Apr 2011
    Posts
    5
    Rep Power
    0

    Default

    Quote Originally Posted by go4soumya View Post
    hi nHulk,

    Try this...

    Java Code:
    int temp1=rs.getInt(1); // here 1 is the column index
    Good luck.
    its not working !!!! giving error as temp1 cannot be resolved

  4. #4
    nHulk's Avatar
    nHulk is offline Member
    Join Date
    Apr 2011
    Posts
    5
    Rep Power
    0

    Default

    I got solution to myself !!! i had not initialized temp variable to zero

Similar Threads

  1. Replies: 3
    Last Post: 10-12-2010, 05:21 PM
  2. Syntax error in eclipse for "enum" defination.
    By gunwantw in forum Eclipse
    Replies: 1
    Last Post: 07-08-2010, 10:21 AM
  3. Replies: 1
    Last Post: 01-21-2010, 10:20 AM
  4. Replies: 2
    Last Post: 01-24-2009, 07:56 PM
  5. Replies: 1
    Last Post: 10-20-2008, 08:35 AM

Tags for this Thread

Posting Permissions

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