Davud Aga
Davud Aga

Reputation: 79

The value or constructor query is not defined

I have a query

query {
    for user in db.Users do 
    join (for selection in db.CourseSelection ->
          user.UserID = selection.UserID)
    select (user, selection)
}
|> Seq.iter (fun (user, selection) -> printfn "%d %s %d" user.UserID user.Name selection.GroupID)

Why it says "The value or constructor 'query' is not defined" ?

I have implemented the Linq library

open System
open System.Linq

or is there a better way to do it in builtin way? Like built-in query expressions?

Upvotes: 2

Views: 164

Answers (1)

Petr
Petr

Reputation: 4280

Here is the documentation and tutorial on F# query expressions: http://msdn.microsoft.com/en-us/library/vstudio/hh225374(v=vs.110).aspx

It states that "Projects should add references to System.Data, System.Data.Linq, and FSharp.Data.TypeProviders assemblies."

Also in a sample it refer to these namespaces:

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

Upvotes: 2

Related Questions