Results 1 to 4 of 4
Thread: jsp "Valu incrementing Syntax""
- 04-26-2011, 10:08 PM #1
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 outLast edited by nHulk; 04-27-2011 at 11:54 AM. Reason: to be active
- 04-27-2011, 03:59 AM #2
Member
- Join Date
- Oct 2010
- Posts
- 32
- Rep Power
- 0
error in temp1
hi nHulk,
Try this...
Good luck.Java Code:int temp1=rs.getInt(1); // here 1 is the column index
- 04-27-2011, 06:58 AM #3
- 04-27-2011, 11:52 AM #4
Similar Threads
-
connection = DriverManager.getConnection(DATABASE_URL,'"+userid +"','"+password+"');
By renu in forum New To JavaReplies: 3Last Post: 10-12-2010, 04:21 PM -
Syntax error in eclipse for "enum" defination.
By gunwantw in forum EclipseReplies: 1Last Post: 07-08-2010, 09:21 AM -
How to change my form design from "metal" to "nimbus" in Netbeans 6.7.1?
By mlibot in forum New To JavaReplies: 1Last Post: 01-21-2010, 09:20 AM -
MoneyOut.println("It took you (whats wrong?>",year,"<WW?) years to repay the loan")
By soc86 in forum New To JavaReplies: 2Last Post: 01-24-2009, 06:56 PM -
the dollar sign "$", prints like any other normal char in java like "a" or "*" ?
By lse123 in forum New To JavaReplies: 1Last Post: 10-20-2008, 07:35 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks