TypeProvider query EXISTS case

Category:
TypeProviders.SqlDataConnection
Description: type provider sample using EXISTS . Use the CreateFSharpSampleDatabase.sql to setup your database tables.
Code:

type T0 = Microsoft.FSharp.Data.TypeProviders.SqlDataConnection< "Data Source=localhost;Initial Catalog=FSharpSample;User ID=sa;Password=FSharpSample1234" >

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

Execution Result:
"Lisa"
"Brent"
"Anita"
"Ken"
"Cathy"
"Tom"
"Zeoy"
"Mark"
"John"
both elements are equal

Last edited Mar 1, 2012 at 7:00 PM by ttliu2000, version 3

Comments

No comments yet.