problem with setting parameter of a PreparedStatement
From: Oliver Hirschi (ohirschi_at_pm-medici.ch)
Date: 03/30/04
- Previous message: Dieter Bender: "Re: silly problem with If statement - JSP/AS400 access"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 30 Mar 2004 08:56:09 +0200
Hi netpeople.
I have got a problem with setting parameters to a statement. I would
like get the last inserted id of a table.
The SQL statement for this on mssqlserver is:
SELECT IDENT_CURRENT(<tablename>) AS <idfieldname>
I use a PrepareStatement:
SELECT IDENT_CURRENT(?) AS ?
How do I set this parameter to the tablename and the idfieldname?
I tried with:
------------------------------------------------------
PreparedStatement oStmt = null;
oStmt =
m_oConn.prepareStatement(JDBCStmt.CBP_RETURNINTERFACE_UPDATE_CONTAINER);
oStmt.setString(1, sTable);
oStmt.setString(2, sField);
-------------------------------------------------------
But with this implementation, the executeQuery() fails.
Special Thanks for your help.
-- Oliver Hirschi http://www.FamilyHirschi.ch
- Previous message: Dieter Bender: "Re: silly problem with If statement - JSP/AS400 access"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]