File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes database error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "database error" Watch "database error" New topic
Author

database error

jil shi
Greenhorn

Joined: Feb 17, 2004
Posts: 20

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;
%>
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61206
    
  66

Not a JSP question but a JDBC one. Moving to the JDBC forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: database error