Adding Parameters to Stored Procedure

  • I have the parameters of the stored proc as follows

    Dim paramsList As New ArrayList()

    paramsList.Add("VARCHAR" & "###" & mstr_Delegator)

    paramsList.Add("VARCHAR" & "###" & txtInvoiceNum.Text)

    paramsList.Add("VARCHAR" & "###" & txtDescr.Text)

    Is it possible to add this parameterList to the SQL command ?

    Dim Conn As New SqlConnection(connStr)

    Dim SqlCmd As New SqlCommand(sqlStoredProc, Conn)

    Dim paramObject() As String

    SqlCmd.CommandType = CommandType.StoredProcedure

    SqlCmd.CommandTimeout = 1000

    Conn.Open()

    If Not (paramsList Is Nothing) Then

    For Each param As SqlParameter In paramsList

    SqlCmd.Parameters.Add(param)

    Next

    End If

    SqlCmd.ExecuteNonQuery()

    Conn.Close()

    SqlCmd = Nothing

    Conn = Nothing

    This code is not working any help as to can we create

    parameters of the stored proc without knowing the names of the actual parameters of the stored proc?

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply