/// <summary> /// Retrieves the set of SqlParameters appropriate for the stored procedure /// </summary> /// <remarks> /// This method will query the database for this information, and then store it in a cache for future requests. /// </remarks> /// <param name="connection">A valid SqlConnection object</param> /// <param name="spName">The name of the stored procedure</param> /// <param name="includeReturnValueParameter">A bool value indicating whether the return value parameter should be included in the results</param> /// <returns>An array of SqlParameters</returns> public static System.Data.SqlClient.SqlParameter[] GetSpParameterSet(string connectionString, string spName, bool includeReturnValueParameter) { SqlConnection sqlConnection = null; System.Data.SqlClient.SqlParameter[] sqlParameterArr; if ((connectionString == null) || (connectionString.Length == 0)) { throw new System.ArgumentNullException("connectionString"); } try { sqlConnection = new SqlConnection(connectionString); sqlParameterArr = SqlHelperParameterCache.GetSpParameterSetInternal(sqlConnection, spName, includeReturnValueParameter); } finally { if (sqlConnection != null) { sqlConnection.Dispose(); } } return(sqlParameterArr); }
/// <summary> /// Retrieves the set of SqlParameters appropriate for the stored procedure /// </summary> /// <remarks> /// This method will query the database for this information, and then store it in a cache for future requests. /// </remarks> /// <param name="connectionString">A valid connection string for a SqlConnection</param> /// <param name="spName">The name of the stored procedure</param> /// <param name="includeReturnValueParameter">A bool value indicating whether the return value parameter should be included in the results</param> /// <returns>An array of SqlParameters</returns> public static System.Data.SqlClient.SqlParameter[] GetSpParameterSet(SqlConnection connection, string spName, bool includeReturnValueParameter) { SqlConnection sqlConnection = null; System.Data.SqlClient.SqlParameter[] sqlParameterArr; if (connection == null) { throw new System.ArgumentNullException("connection"); } try { sqlConnection = (SqlConnection)((ICloneable)connection).Clone(); sqlParameterArr = SqlHelperParameterCache.GetSpParameterSetInternal(sqlConnection, spName, includeReturnValueParameter); } finally { if (sqlConnection != null) { sqlConnection.Dispose(); } } return(sqlParameterArr); }