mausch / FsSql

Functional wrapper around ADO.NET for F#
https://www.openhub.net/p/FsSql
Apache License 2.0
67 stars 15 forks source link

Dynamic operator not working - improved documentation needed? #33

Open spiffytech opened 9 years ago

spiffytech commented 9 years ago

I'm following the docs and trying to get a basic example working where I read some values out of my database. F# insists that (row?mood).Value is an indeterminate type. It's not clear from the example blog posts, or the unit tests, why this wouldn't work.

The relevant portions of my code:

open FsSql
// declare execReader etc. shortcuts as outlined in blog post

let private sleepOfSql (row:IDataRecord) =
    let x = (row?mood).Value
    // do more stuff

execReader "select * from sleeps where userId = @userId and @start <= date and date <= @fin" [P("@userId", userId'); P("@start", start); P("@fin", fin)]
|> Seq.ofDataReader
|> Seq.map (sleepOfSql)
mausch commented 9 years ago

Missed this question, sorry. You probably need to add an explicit type annotation to disambiguate.

czifro commented 6 years ago

@spiffytech Has this been resolved?