处理 Exists

来源:互联网 发布:云购网站源码 编辑:程序博客网 时间:2024/06/10 18:49

处理 Exists

#r @"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.Linq.dll";;
#r @"E:\Projects\F#3\FSharp.Data.TypeProviders.dll";;
open Microsoft.FSharp.Data.TypeProviders;;

[<Generate>]
type T0 = SqlDataConnection<"Data Source=.\SQLEXPRESS;Initial Catalog=FSharpSample;User ID=sa;Password=FSharpSample1234">

let TypeProvider3 () =
    let db = T0.GetDataContext();
    let q = query {
        for s in db.Student do
        where (query {for c in db.CourseSelection do exists (c.StudentID = 1)})
        select s
    }
    q |> Seq.iter (fun n -> printfn "%A" n.Name)

原创粉丝点击