I write the following code for accessing the last record from the table
By this code i want to auto increment the Item_ID field .
Type of Item_ID field is varchar

i face the problem that : this code is not executed, i am getting error in this statement,i have properly tested the following code
- Item_ID = rs.getString(1);



protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();

String Item_ID = "";

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:OnlineElect ricals");
Statement stat = con.createStatement();
ResultSet rs = stat.executeQuery("select top(1) * from Item_Details ORDER BY Item_ID DESC");

Item_ID = rs.getString(1);

out.println("BB" +Item_ID);
String Item = Item_ID.substring(0,1);
String ID = Item_ID.substring(2);
ID = ID + 1;
Item_ID = Item + ID;

rs.close();
stat.close();
con.close();

}
catch(Exception e)
{
System.out.println(e);
}


String Item_Type = request.getParameter("Item_Type");
String Item_Company = request.getParameter("Item_Company");
String Item_Name = request.getParameter("Item_Name");
String Item_Description = request.getParameter("Item_Description");
String Item_MRP = request.getParameter("Item_MRP");
String Item_Rate = request.getParameter("Item_Rate");
String Image_Path = request.getParameter("Image_Path");

try {

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection con = DriverManager.getConnection("jdbc:odbc:OnlineElect ricals");

Statement stat = con.createStatement();

stat.executeUpdate("insert into Item_Details values('" + Item_ID + "','" + Item_Type + "','" + Item_Name+"'," +
"'" + Item_Description + "','" + Item_Company + "'," +
"'" + Item_Rate + "','" + Item_MRP + "','" +Image_Path + "')");
out.println("F");

stat.close();
con.close();

}
catch(Exception e)
{
System.out.println(e);
}

} finally {
out.close();
}
}