Well nice question.... You need to use SqlParameter[] for executing this type of storedprocedure. The question is how this could be done... See the following code snippets..
(i) Input / Calling the StoredProcedure:
for (iCount = 0; iCount <= 4; iCount++)
{
oSQLParameter[iCount] = new SqlParameter();
if (iCount == 4)
oSQLParameter[iCount].Direction = ParameterDirection.Output;
else
oSQLParameter[iCount].Direction = ParameterDirection.Input;
}
oSQLParameter[0].ParameterName = MyParama;
oSQLParameter[0].Size = 30;
oSQLParameter[0].Value = "Test";
..........
..........
retValur= oSQLParameter[4].Value.ToString();
(ii) Executing the StoredProcedure:
public int ExecuteNonQueryStoredProcedure(string strConnectionString, string strStoredProcedureName, SqlParameter[] _ObjSqlParameter)
{
SqlConnection _ObjConnection;
SqlCommand _ObjCommand;
int iRowsAffected;
_ObjConnection = new SqlConnection(strConnectionString);
_ObjConnection.Open();
_ObjCommand = new SqlCommand(strStoredProcedureName, _ObjConnection);
_ObjCommand.CommandType = CommandType.StoredProcedure;
foreach (SqlParameter collObj in _ObjSqlParameter)
{
_ObjCommand.Parameters.Add(collObj);
}
iRowsAffected = _ObjCommand.ExecuteNonQuery();
_ObjCommand.Dispose();
_ObjConnection.Close();
_ObjConnection.Dispose();
return iRowsAffected;
}
Hope this may helped you... :)