Wednesday, March 7, 2012

Problems with carating Stored Procedure from ADO

Hi
I try to create SP from ADO. Open connection and excecute queries.
con.Execute "SET QUOTED_IDENTIFIER OFF "
con.Execute "SET ansinull ON"
con.Execute TextProc
TextProc content
"
create procedure BISSGetDllName (
@.ID_MESS numeric(10) = 0,
@.SwiftOperType int = 0,
@.IsAction int=1
) as
Begin
/**********************************************************
@.ID_MESS - message
@.SwiftOperType - operation
@.IsAction - action or rollback?
*********************************************************/
declare
@.ret int,
@.MessageType int,
@.AccBalance1 int,
@.urgency varchar(1)
select
@.MessageType = MessageType
from BISSHead
where ID_MESS = @.ID_MESS
select @.urgency='s'
from BISSMess
where
ID_MESS=@.ID_MESS and
NumOfField='203B' and
convert(int,ContextOfField)=1
/*BIS aaieianeee */
if @.MessageType= 202
begin
if exists(select 1 from BISSMess where ID_MESS=@.ID_MESS and
NumOfField ='58E')
select '_trbis202.dll','TrBIS2202'+@.urgency+'NR'
else
select '_trbis202.dll','TrBIS2202'+@.urgency
return 1
end
else if @.MessageType= 103
begin
/*BIS iaeiae*/
declare @.IsTax int
exec @.ret=BISSIsTax @.ID_MESS, @.IsTax output
if @.ret<>1
return @.ret
if @.IsTax=1
begin
select '_trbistax.dll','TrBISTax'+@.urgency
return 1
end
/*select @.AccBalance1 = convert(int,substring(KorrAccount,1,4))
from BISSMessAddition
where ID_MESS = @.ID_MESS
*/
/*BIS eeeaioneee*/
/*if exists(select 1
from ReportSetup
where
Code = 29 and
Amount1=0 and
AccBalance1<>@.AccBalance1
) */
begin
if exists(select 1 from BISSMess where ID_MESS=@.ID_MESS and
NumOfField ='57E')
select '_trbiss100.dll','TrBIS100'+@.urgency+'NR'
else
select '_trbiss100.dll','TrBIS100'+@.urgency
return 1
end
end
return -1221
end
"
ADO sad [SYBASE][OLE DB Sybase provider]Value has not been specified for
parameter 1.
May bee ADO find parametrs in Create query.. and want values for parametrs.
How could execute this query...Please don't multi-post. And stop using a Sybase provider if you're
connecting to SQL Server! http://www.aspfaq.com/2126
"Dmitry" <Savtchin@.st.by> wrote in message
news:u2irvPaxEHA.3096@.TK2MSFTNGP14.phx.gbl...
> Hi
> I try to create SP from ADO. Open connection and excecute queries.
> con.Execute "SET QUOTED_IDENTIFIER OFF "
> con.Execute "SET ansinull ON"
> con.Execute TextProc
> TextProc content
> "
> create procedure BISSGetDllName (
> @.ID_MESS numeric(10) = 0,
> @.SwiftOperType int = 0,
> @.IsAction int=1
> ) as
> Begin
> /**********************************************************
> @.ID_MESS - message
> @.SwiftOperType - operation
> @.IsAction - action or rollback?
>
> *********************************************************/
> declare
> @.ret int,
> @.MessageType int,
> @.AccBalance1 int,
> @.urgency varchar(1)
> select
> @.MessageType = MessageType
> from BISSHead
> where ID_MESS = @.ID_MESS
> select @.urgency='s'
> from BISSMess
> where
> ID_MESS=@.ID_MESS and
> NumOfField='203B' and
> convert(int,ContextOfField)=1
> /*BIS aaieianeee */
> if @.MessageType= 202
> begin
> if exists(select 1 from BISSMess where ID_MESS=@.ID_MESS and
> NumOfField ='58E')
> select '_trbis202.dll','TrBIS2202'+@.urgency+'NR'
> else
> select '_trbis202.dll','TrBIS2202'+@.urgency
> return 1
> end
> else if @.MessageType= 103
> begin
> /*BIS iaeiae*/
> declare @.IsTax int
> exec @.ret=BISSIsTax @.ID_MESS, @.IsTax output
> if @.ret<>1
> return @.ret
> if @.IsTax=1
> begin
> select '_trbistax.dll','TrBISTax'+@.urgency
> return 1
> end
> /*select @.AccBalance1 = convert(int,substring(KorrAccount,1,4))
> from BISSMessAddition
> where ID_MESS = @.ID_MESS
> */
> /*BIS eeeaioneee*/
> /*if exists(select 1
> from ReportSetup
> where
> Code = 29 and
> Amount1=0 and
> AccBalance1<>@.AccBalance1
> ) */
> begin
> if exists(select 1 from BISSMess where ID_MESS=@.ID_MESS and
> NumOfField ='57E')
> select '_trbiss100.dll','TrBIS100'+@.urgency+'NR'
> else
> select '_trbiss100.dll','TrBIS100'+@.urgency
> return 1
> end
>
> end
> return -1221
> end
> "
> ADO sad [SYBASE][OLE DB Sybase provider]Value has not been specified for
> parameter 1.
> May bee ADO find parametrs in Create query.. and want values for
parametrs.
> How could execute this query...
>

No comments:

Post a Comment