WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ADO DAO
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

ADO Sample for Stored Procedure


Stored Procedure:
alter PROCEDURE abcd
@WSID nvarchar(50)

AS
set nocount on

INSERT INTO TblFTPLog
(wsid)
VALUES (@wsid)

select @@identity as 'NewID'
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO
This code returns the inserted record identity so now the winbatch program can continue and do some things with the id. Very cool if you are inserting a batch of records in a header/detail related tables setup. I know it doesn't deal with SQL transactions and rollback, but that is not always necessary.
cConn = GLBARY[0] ; connect string
DB = ObjectOpen("ADODB.Connection")
DB.Open(cConn)
csql = "abcd @wsid='goober'"
rs = db.execute(csql)
While !rs.eof
rval = rs.fields("newid").value
rs.movenext
EndWhile
rs.close()
ObjectClose(rs)
DB.close
ObjectClose(DB)
Message("NewID",rval)


Other resources: http://authors.aspalliance.com/stevesmith/articles/sprocs.asp


Article ID:   W17104
File Created: 2007:07:03:14:28:20
Last Updated: 2007:07:03:14:28:20