IDataReader.ToDataSet

namespace Foo

open System.Data

[<AutoOpen>]
module FsDataEx =

    type System.Data.IDataReader with
        /// Populates a new DataSet with the contents of the reader. Closes the reader after completion.
        member this.ToDataSet () =
            use reader = this
            let dataSet = new DataSet(RemotingFormat=SerializationFormat.Binary, EnforceConstraints=false)
            dataSet.Load(reader, LoadOption.OverwriteChanges, [| "" |])
            dataSet
Example:
let ds = reader.ToDataSet()

Description

Converts an IDataReader into a DataSet, without requiring a DataAdapter.

Details

Double click on the code to select all.

 

;