Accessing data from sqldatereader within a function
<p>I want to output some data to the user based on their username. This data is held in a table that is linked to the aspnet_Users table.  I'm trying to write a sqldatareader as part of a function so I don't have to rewrite the code when it could be called from several pages.  I know this is probably very simple buty I can't seem to access the data from outside the function. The function I have so far is as follows:</p>

<pre><code>Public Shared Function AgencyDetails() As SqlDataReader
    Dim details As String = "SELECT * FROM tbl_Relationships WHERE ContactSub = @Username"
    Dim connString As String = ConfigurationManager.ConnectionStrings("ApplicationServices").ConnectionString

    Using dbConnection As New SqlConnection(connString)
        dbConnection.Open()
        Dim cmdAgency As New SqlCommand(details, dbConnection)
        cmdAgency.Parameters.AddWithValue("@Username", membership.getuser)
        Return cmdAgency.ExecuteReader()


    End Using
End Function
</code></pre>

<p>How can I call this function and access the information on my page? Something like the following?</p>

<pre><code>lblAgencyDetails.text = AgencyDetails(0)
</code></pre>

<p>Thanks</p>
