I was wondering how you can get the value of a field in a database when you
are adding a new record and are not posting that value yourself (eg an auto
incrementing value)
Here is my code. I need the value of the AUTO_ID field from the DB to be
outputted at XXXXXX
Class.forName("org.gjt.mm.mysql.Driver");
Connection myConn
DriverManager.getConnection("jdbc:mysql:///mydatabase?user=aaa&password=bbb");
Statement stmt = myConn.createStatement();
int rowsAffected = 0;
try {
rowsAffected = stmt.executeUpdate("INSERT INTO customer
(FAMILY,GIVEN,ADDRESS) VALUES ('" + request.getParameter("FAMILY") + "','" +
request.getParameter("GIVEN") + "','" + request.getParameter("ADDRESS") "')
");
if (request.getParameter("where") != null) {
String where = request.getParameter("where");
if (where.equalsIgnoreCase("invoice")) {
request.sendRedirect("invoice.jsp?id=" + XXXXXX);
}
}
} catch (SQLException se) {}
Thanks HEAPS for any assistance you can give me
James McIntosh
james@w...