This project is read-only.
TypeProvider query IN case

Description: type provider sample using IN. Use the CreateFSharpSampleDatabase.sql to setup your database tables.
type T0 = Microsoft.FSharp.Data.TypeProviders.SqlDataConnection< "Data Source=localhost;Initial Catalog=FSharpSample;User ID=sa;Password=FSharpSample1234" >

let TypeProvider2() =
let db = T0.GetDataContext();
let q2 = query {
for n in db.Course do
join (for e in db.CourseSelection -> n.CourseID = e.CourseID.Value)
select (n.CourseName, e.StudentID)
let names = [|"Lisa";"Brent";"Jimmy"|]
let q = query {
for n in db.Student do
if names.Contains (n.Name) then select n
q |> Seq.iter (fun n -> printfn "%A" n.Name)
Assert.AreEqual(q |> Seq.length, 2)

Execution Result:
both elements are equal

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


No comments yet.