CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Java

 Retieve @@IDENTITY from stored proceedure

Print topic Send  topic

Author Message
Rihn

Posts: 6
Posted: 03/29/2004, 1:01 PM

Here is the sp code that I tried.

CREATE PROCEDURE [SDE],[myReptnum]
@Identity INT OUTPUT,
@ACC INT= NULL,
@species varchar[50] = null,
AS
INSERT INTO TESTTable1 [ACC,species] VALUES[NULL,NULL]
SELECT @@IDENTITY
RETURN @Identity
GO

This seems to add a row but I get nothing back when I tried to use the sp as the source for the form and the form has no buttons.
I tried to use a Before show action of Dlookup with no success either.
Need to know how to call a stored proceedure in javascript.
_________________
Harold Rihn
View profile  Send private message
ignat


Posts: 55
Posted: 03/29/2004, 10:49 PM

Unfortunately Code Charge Studio has only little support for stored
procedure output parameters.

To solve your problem I would create a custom insert nop operation, that do
nothing. And then in AfterExecuteInsert event I would obtain connection
from the pool and through standard JDBC CallableStatement perform
insert and retrieve identity. Then you can save the identity value in
the session or some other variable for future use.

You could also split your procedure into normal insert and
'select @@identity', but in such case you will need to call both
commands in one transaction, which is hard with CCS as well.

Regards,
Ignat.
View profile  Send private message
peterr


Posts: 5971
Posted: 03/30/2004, 5:00 PM

Harold,
Actually, I'm not sure exactly how you'd lke to use this SP. It seems that you'd like to pre-generate a key/id before the form is submitted. I'm not sure if this will work well logically, but here is the sample code that should retrieve the value returned by your SDE procedure in the Before Show event:
CallableStatement cstmt = e.getConnection().createCallableStatement("{call SDE(?)}");  
    cstmt.registerOutParameter(1, Types.INTEGER);  
    cstmt.execute();  
    int value = cstmt.getInteger(1);  

_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.