• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

database error

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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;
%>
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not a JSP question but a JDBC one. Moving to the JDBC forum.
reply
    Bookmark Topic Watch Topic
  • New Topic