I have the following code and I want the function getCol1Col2
returns tuple of Col1, Col2
instead of Linq.IQueryable<>
. How to write it? This is newbie question.
And how to returns none if there is no row found in the database table?
open System
open System.Data
open System.Data.Linq
open Microsoft.FSharp.Data.TypeProviders
open Microsoft.FSharp.Linq
open System.Net
open System.IO
type dbSchema = SqlDataConnection<"Data Source=server;Initial Catalog=db;Integrated Security=SSPI;">
let getFirstCol1Col2 =
let db = dbSchema.GetDataContext()
db.DataContext.Log <- System.Console.Out
let query = query {
for row in db.MyTable do
where (row.ID = 1)
select (row.Col1, row.Col2) }
query //.... Need to return the tuple of Col1, Col2