J
Jacques Wentworth
Hi
I have the following problem. I have a SQL Server (2000) Stored Proc that
with 4 parameter (one being @UnlockKey uniqueidentifier OUTPUT). I run it
from Query Analyzer and the @Key parameter is valued. When I run it from
VB.Net it is empty. I tried it with other other datatype and it works fine.
Am I doing something wrong?
Thanks
Jacques Wentworth
See my code snippet below.
Dim cn As SqlConnection = _
New SqlConnection("server=2000server;uid=sa;pwd=;database=bar")
cn.Open()
Dim co As SqlCommand = _
New SqlCommand("EditListSelectID", cn)
co.CommandType = CommandType.StoredProcedure
Dim pID As SqlParameter = BuildParam("@id", SqlDbType.BigInt, 0,
ParameterDirection.Input)
Dim pLock As SqlParameter = BuildParam("@Lock", SqlDbType.Bit, 0,
ParameterDirection.Input)
Dim pUserID As SqlParameter = BuildParam("@UserID", SqlDbType.BigInt, 0,
ParameterDirection.Input)
Dim pUnlockKey As SqlParameter = BuildParam("@UnlockKey",
SqlDbType.UniqueIdentifier, 0, ParameterDirection.Output)
pID.Value = ID
pLock.Value = 1
pUserID.Value = 1
'pUnlockKey.Value = New System.Guid()
co.Parameters.Add(pID)
co.Parameters.Add(pLock)
co.Parameters.Add(pUserID)
co.Parameters.Add(pUnlockKey)
co.ExecuteReader()
'co.ExecuteNonQuery()
'Dim myReader As SqlDataReader = co.ExecuteReader()
I have the following problem. I have a SQL Server (2000) Stored Proc that
with 4 parameter (one being @UnlockKey uniqueidentifier OUTPUT). I run it
from Query Analyzer and the @Key parameter is valued. When I run it from
VB.Net it is empty. I tried it with other other datatype and it works fine.
Am I doing something wrong?
Thanks
Jacques Wentworth
See my code snippet below.
Dim cn As SqlConnection = _
New SqlConnection("server=2000server;uid=sa;pwd=;database=bar")
cn.Open()
Dim co As SqlCommand = _
New SqlCommand("EditListSelectID", cn)
co.CommandType = CommandType.StoredProcedure
Dim pID As SqlParameter = BuildParam("@id", SqlDbType.BigInt, 0,
ParameterDirection.Input)
Dim pLock As SqlParameter = BuildParam("@Lock", SqlDbType.Bit, 0,
ParameterDirection.Input)
Dim pUserID As SqlParameter = BuildParam("@UserID", SqlDbType.BigInt, 0,
ParameterDirection.Input)
Dim pUnlockKey As SqlParameter = BuildParam("@UnlockKey",
SqlDbType.UniqueIdentifier, 0, ParameterDirection.Output)
pID.Value = ID
pLock.Value = 1
pUserID.Value = 1
'pUnlockKey.Value = New System.Guid()
co.Parameters.Add(pID)
co.Parameters.Add(pLock)
co.Parameters.Add(pUserID)
co.Parameters.Add(pUnlockKey)
co.ExecuteReader()
'co.ExecuteNonQuery()
'Dim myReader As SqlDataReader = co.ExecuteReader()