This project is read-only.
TypeProvider sum

Category:
TypeProviders.SqlDataConnection
Description: Use sum to get the total age for all the students
Code:
type T0 = Microsoft.FSharp.Data.TypeProviders.SqlDataConnection< "Data Source=localhost;Initial Catalog=FSharpSample;User ID=sa;Password=FSharpSample1234" >

let TypeProvider17() =
let db = T0.GetDataContext();
let q = query {
for n in db.Student do
sumByNullable n.Age
}
q |> printfn "sum of age = %A"

Execution Result:
sum of age = 171

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

Comments

No comments yet.