Using keyword with radgrid needdatasource

2 posts, 0 answers
  1. Dana Cobb
    Dana Cobb avatar
    46 posts
    Member since:
    Mar 2007

    Posted 10 Apr 2013 Link to this post

    When i bind a grid to a datareader in the needdatasource like this:

    Dim rs As SqlDataReader = SqlHelper.ExecuteReader(GetConnectionString("mv4Conn", "mvdata", ConfigurationManager.AppSettings("CircViewDB")), Data.CommandType.Text, sbFilter.ToString)
                   Me.RadGrid1.DataSource = rs

    should i be using the USING keywod like this:

    Using reader As SqlDataReader = getReader()
        ddlCustomer.DataSource = reader
    End Using
     
    to make sure that the datareader is disposed of?

    thanks,
    Dana







  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 10 Apr 2013 Link to this post

    Hi,

    You can use reader.Close(); method to close the reader. Check the following help documentation which explains more about this.
    Binding To DataReader

    Thanks,
    Shinu
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top