ParameterDirection qustion

jvcoach23

Well-known member
Joined
May 22, 2003
Messages
192
Location
Saybrook, IL
Im using Vb 2005 and Sql 2005. Im trying to use the ParameterDirection.inputout... and its not working.

Code:
 With cm
                    .Parameters.Add("@intTblWaitingListId", SqlDbType.Int).Value = mintTblWaitingListId
                    .Parameters("@intTblWaitingListId").Direction = ParameterDirection.InputOutput
end with

    cn.Open()
                cm.ExecuteNonQuery()

when i trace this in sql.. this is what it is sending in

Code:
declare @p1 int
set @p1=8
exec spWaitingList_Save @intTblWaitingListId=@p1 output,@intTblCamperId=781,@intTblWeekId=1,@intPriority=0,@intMisses=0
select @p1

the set @p1=8.. the 8 seems to be the number of times Ive tried running this for.. since it seems to increment each time I run it.

now.. if I take comment out the
Code:
                    .Parameters("@intTblWaitingListId").Direction = ParameterDirection.InputOutput

then the value getting passed into @intTblWaitingListId is the value I want.

anyone have any ideas...
thanks
shannon
 
What is the value of mintTblWaitingListId when you are calling this? Also what does the code for spWaitingList look like?
Also have you tried setting the direction before assigning a value?
 
PlausiblyDamp said:
What is the value of mintTblWaitingListId when you are calling this? Also what does the code for spWaitingList look like?
Also have you tried setting the direction before assigning a value?


The mintTblWaitingListId =0. ive checked while debuging and it is indeed 8.

Here is the sp portion youd be interested in i think

ALTER procedure [dbo].[spWaitingList_Save]
@intTblWaitingListId int=null OUTPUT
,@intTblCamperId int=null
,@intTblWeekId int=null
,@intPriority int=null
,@intMisses int=null


No, i havent tried telling the parm a direction before I do the add. guess i just figured that wouldnt work since I figured that you would have to add it before you coudl tell it that it had a direction... but Ill try it..

thanks
shannon
 
I tried this...

Code:
 .Parameters.Add("@intTblWaitingListId", SqlDbType.Int)
                    .Parameters("@intTblWaitingListId").Direction = ParameterDirection.InputOutput
                    .Parameters("@intTblWaitingListId").Value = mintTblWaitingListId

Still no good.. here is the trace file and what was sent to sql server...

Code:
declare @p1 int
set @p1=10
exec spWaitingList_Save @intTblWaitingListId=@p1 output,@intTblCamperId=781,@intTblWeekId=1,@intPriority=0,@intMisses=0
select @p1

kind of weird..
thanks
shannon
 
Back
Top