How to pass 2 parameters to a sql server stored proc in ado.net
I am using data access application block and there is a method called as "executereader" and it expects parameters in array.
the syntax for this method is
sqlhelper.executeReader(connectionstring as string, spname as string, paramarray Parametervalues() as object)
The stored proc I am passing has 2 parameters.
first paramter is :
parameter name is customerID
and parameter value is '1'
second paramter is:
parameter name is orderid
and paramter value is '1028'
can someone give some lead as how to build these 2 paramters?
thanks
nath
executeReader(connectionstring as string, spname as string, paramarray Parametervalues() as object) first paramter is : second paramter is:
thank you both...I will try ...regards
so the "arrparameters" is collection
dim arrparameters as collection()
Is that correct?
visual basic code:--------------------------------------------------------------------------------
Dim prmDetails() As SqlClient.SqlParameter
prmDetails = SqlHelperParameterCache.GetSpParameterSet(ConnectionStringHere, StoredProcNameHere)
'Set parameters where your ordered params are in arrParameters
For intParamCounter As Integer = 0 To arrParameters.Count() - 1
prmDetails(intParamCounter).Value = arrParameters.Item(intParamCounter)
Next
'Return the DataReader
Return SqlHelper.ExecuteReader(ConnectionStringHere, CommandType.StoredProcedure, StoredProcNameHere, prmDetails)
--------------------------------------------------------------------------------
got it..no worries..thanks