Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm using Vb 2005 and Sql 2005. I'm trying to use the ParameterDirection.inputout... and it's not working.

 

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

 

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 I've tried running this for.. since it seems to increment each time I run it.

 

now.. if I take comment out the

                   .Parameters("@intTblWaitingListId").Direction = ParameterDirection.InputOutput

 

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

 

anyone have any ideas...

thanks

shannon

JvCoach23

VB.Net newbie

MS Sql Vet

Posted
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. i've checked while debuging and it is indeed 8.

 

Here is the sp portion you'd 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 haven't tried telling the parm a direction before I do the add. guess i just figured that wouldn't work since I figured that you would have to add it before you coudl tell it that it had a direction... but I'll try it..

 

thanks

shannon

JvCoach23

VB.Net newbie

MS Sql Vet

Posted

I tried this...

 

.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...

 

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

JvCoach23

VB.Net newbie

MS Sql Vet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...