database error

  • jilshi
  • Novice
  • Novice
  • User avatar
  • Posts: 32

Post 3+ Months Ago

:( :confused:
for your information, i'm using jsp to create my web page. i am inserting sequence number into the database. When first data in insert into database it will show number 1 in the database. when second data in insert in database, it will show number 2 in the database. the data are inserted when user click submit button from the web page.
i am creating a page name main.jsp. when the user select option from the list bar, it will link to new page. the option value in the list bar are 'sentul view' and 'cityview'. if the user choose 'cityview', it will link to new page that allows user to key in their information. the problem is sequence number was enter wrongly into database. when the first user click submit after selected "city view', sequence in 'cityview' database will increase. then when the other user register 'sentul view', the database sequence will start from number 2 in 'sentul view' database. how to avoid the problem...
i enclosed some part of the code:

<%
String sql_selectMax = "SELECT max(smb_regr_seq_no) as maxNo "+
"FROM smbyer ";
Statement stmt_selectMax = conn.createStatement();
ResultSet rset_selectMax = stmt_selectMax.executeQuery(sql_selectMax);
while(rset_selectMax.next()){
reqNo = rset_selectMax.getInt("maxNo");
out.print (reqNo);
}
reqNo = reqNo + 1;
%>

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 119 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.