Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Adding Parameters to Stored Procedure Expand / Collapse
Author
Message
Posted Monday, June 23, 2008 7:44 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, July 21, 2008 2:22 AM
Points: 10, Visits: 60
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?

Post #521772
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse