BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

stored procedure

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (dbExpress)
View previous topic :: View next topic  
Author Message
Charles Adriano
Guest





PostPosted: Tue Dec 28, 2004 10:00 pm    Post subject: stored procedure Reply with quote




sorry for simple question

i have a table (SQLServer 2000)

Dg0000001
Key varcahr(50)
ID bigint


i have this record

key ID
Dg0010001 1
Dg0010002 1

and i have a stored procedure for generate and reserve IDs

CREATE PROCEDURE ReserveID @Key varchar(40), @Count bigint AS
declare @NextID integer
begin transaction
update Dg0000001
set ID = ID + @Count
Where Nome = @Key
select @NextID = (ID - @Count + 1) From Dg0000001
commit transaction
RETURN @NextID

--------------------------------------------------------- use
declare @NextID integer
exec @NextID = ReserveID 'Dg0010001',1
select @NextID as FirstNextID
--------------------------------------------------------- end use

i have a D7 + DBExpres

and SQLQuery

CommandText = ReserveID
CommandType = ctStoredProc

with params

Key ftString ptInput
Count ftInteger ptInput
Ret ftInteger ptResult

when executed the code

SQLQuery.Params.ParamByName('KEY').AsString := '0010001';
SQLQuery.Params.ParamByName('Count').AsInteger := 1;
SQLQuery.execsql(true); // or SQLQuery.execsql(fakse)

showed this message

List index out of bouns(0)

Questions

1) i missing
2) how i call stored procedure with result and arguments


charles

sorry for my english


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (dbExpress) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.