Q:

Returning results from stored procedure as IEnumerable

i am not sure how to properly complete this - i have a stored proc and i want to return the results as an IEnumberable
  public IEnumerable GetGuids(int id)
    {
        SqlCommand _command = new SqlCommand("storedProc");
        _command.CommandType = CommandType.StoredProcedure;
        _command.Parameters.AddWithValue("@ItemID", id);

        return _command.ExecuteReader();
    }

when i run this i get: ExecuteReader: Connection property has not been initialized.

A:

Your SqlCommand does not have a corresponding connection. Either use:
_command.Connection = conn;

or create the SqlCommand by using conn.CreateCommand(...)

A:

Pass the connection object like this GetGuids(int id, SqlConnection conn)
 SqlCommand cmd = new SqlCommand ("query", conn);

