Output parameter not fed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to call the following SP (on a SQL 2000 database

CREATE PROCEDURE fsp_NextSequenceCd

@Entity as varchar(50)
@Sequence as varchar(50) OUTPU

A
[...

Which basically retreive the next sequence ID for the specified Entity. It works fine when called in VB6 or in SQL Query Analyser

However, the following VB.Net code will not work (An empty string is always returned in the Output parameter)

Public Function GetNextSequence(ByVal Type As enSequenceType) As Strin
Dim Command As New SqlClient.SqlComman

Command.Connection = mConnectio
Command.CommandType = CommandType.StoredProcedur
Command.CommandText = Me.CST_SP_NEXT_SEQ_C

Dim NewParam = New SqlClient.SqlParamete

NewParam.Direction = ParameterDirection.Inpu
NewParam.ParameterName = "@Entity
NewParam.SqlDbType = SqlDbType.VarCha
NewParam.value = "LOT

Command.Parameters.Add(NewParam

NewParam = New SqlClient.SqlParamete

NewParam.Direction = ParameterDirection.Outpu
NewParam.ParameterName = "@Sequence
NewParam.SqlDbType = SqlDbType.VarCha
NewParam.value = System.Data.SqlTypes.SqlString.Nul

Command.Parameters.Add(NewParam

Command.ExecuteNonQuery(

Return Command.Parameters.Item("@Sequence").Valu
End Functio
 
Alex,

Your VB.Net code looks correct. Is the @Sequence parameter being SET
somewhere in the Stored Procedure?

Wes
 
Back
Top