Calling a Stored Procedure in a Stored Procedure Group

D

DJM

This function:
Public Function RunSP(ByVal SP As String, ByVal ReturnType As ReturnType,
Optional ByVal Params As Hashtable = Nothing) As ObjectDim oCmd As
SqlClient.SqlCommand = WarehouseDBCommand(SP)

Dim SqlParameter As SqlClient.SqlParameter

oCmd.CommandType = CommandType.StoredProcedure

SqlClient.SqlCommandBuilder.DeriveParameters(oCmd)

If Not Params Is Nothing Then

For Each SqlParameter In oCmd.Parameters

If Params.ContainsKey(SqlParameter.ParameterName) Then

If IsDBNull(Params.Item(SqlParameter.ParameterName)) Then

SqlParameter.Value = DBNull.Value

Else

SqlParameter.Value = Params.Item(SqlParameter.ParameterName).ToString

End If

End If

Next

End If

RunSP = RunAndReturn(oCmd, ReturnType)

oCmd.Connection.Close()

oCmd.Dispose() : oCmd = Nothing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top