J
jobs
How do you return dataset from a vb.net function?
my sp:
ALTER FUNCTION [dbo].[GetAllUsers_test_fn]
(
)
RETURNS TABLE
AS
RETURN
(
SELECT * from users
)
my function:
Function GetAllUsers() As DataSet
Dim cmd As New SqlCommand
With cmd
.CommandType = CommandType.StoredProcedure
.CommandText = "GetAllUsers_test_fn"
.CommandTimeout = 0
.Connection = p_cnn
.Parameters("@return").Direction =
ParameterDirection.ReturnValue
End With
cmd.ExecuteScalar()
Dim result As DataSet
result = cmd.Parameters("@return").Value
Return result
cmd.Dispose()
p_cnn.Close()
End Function
I'm getting this error:
An SqlParameter with ParameterName "@return" is not contained by this
SqlParameterCollection
my sp:
ALTER FUNCTION [dbo].[GetAllUsers_test_fn]
(
)
RETURNS TABLE
AS
RETURN
(
SELECT * from users
)
my function:
Function GetAllUsers() As DataSet
Dim cmd As New SqlCommand
With cmd
.CommandType = CommandType.StoredProcedure
.CommandText = "GetAllUsers_test_fn"
.CommandTimeout = 0
.Connection = p_cnn
.Parameters("@return").Direction =
ParameterDirection.ReturnValue
End With
cmd.ExecuteScalar()
Dim result As DataSet
result = cmd.Parameters("@return").Value
Return result
cmd.Dispose()
p_cnn.Close()
End Function
I'm getting this error:
An SqlParameter with ParameterName "@return" is not contained by this
SqlParameterCollection