This project is read-only.
TypeProvider query TOP and Nullable case

Category:
TypeProviders.SqlDataConnection
Description: type provider sample: TOP and nullable. 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 TypeProvider11() =
let db = T0.GetDataContext();
let q = query {
for n in db.Student do
where ((n.Age.HasValue && n.Age.Value =21) || (n.Age.HasValue && n.Age.Value=22))
select n.Name
take 2
}
q |> Seq.iter (fun n -> printfn "%s" n)
Assert.AreEqual(q |> Seq.length, 2)

Execution Result:
Lisa
Brent
both elements are equal

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

Comments

No comments yet.