f#type provider使用简单的groupby和count

时间:2013-09-11 22:41:37

标签: f# type-providers f#-3.0

为什么不编译

open System
open System.Data
open System.Data.Linq
open System.Linq
open Microsoft.FSharp.Data.TypeProviders
open Microsoft.FSharp.Linq
open Microsoft.FSharp.Linq.RuntimeHelpers

type dbSchema = SqlDataConnection<"Data Source=.;Initial Catalog=MyDatabase;Integrated Security=SSPI;">
let db = dbSchema.GetDataContext()

query {
    for row in db.Table1 do
    groupBy row.Id into gr
    select( gr.Key (gr.Count()))
    }
 |> Seq.iter (fun row -> printfn "Found row: %d" row.Count)

我在行

中遇到编译错误
select( gr.Key (gr.Count()))

有错误错误:此值不是函数且无法应用

1 个答案:

答案 0 :(得分:-1)

我知道了,它丢失了,在密钥和计数之间