TypeProvider average

Category:
TypeProviders.SqlDataConnection
Description: TypeProvider average
Code:
type T0 = Microsoft.FSharp.Data.TypeProviders.SqlDataConnection< "Data Source=localhost;Initial Catalog=FSharpSample;User ID=sa;Password=FSharpSample1234" >

let TypeProvider16() =
let db = T0.GetDataContext();
let q = query {
for n in db.Student do
let f = float(n.Age.GetValueOrDefault())
averageBy f
}
q |> printfn "average age = %A"

Execution Result:
average age = 19.0

Last edited Mar 1, 2012 at 7:04 PM by ttliu2000, version 2

Comments

No comments yet.