Question

I have a F# 3.0 program using typeproviders that I am building in Visual Studio 11. I have a SQL Server 2012 database with a table called Article that has a DateTime column Harvest_Time (not null).

In my program I have:

let newrec = new dbSchema.ServiceTypes.Article( Article_Id = System.Convert.ToInt64(ai))
newrec.Url <- art.Item("url").InnerText
newrec.Source <- art.Item("source").InnerText
newrec.Harvest_time = DateTime.Now
db.Article.InsertOnSubmit(newrec)
db.DataContext.SubmitChanges()

which fails because the value of the Harvest_time column is not being set. If I comment out that line the record is inserted just fine. The failure is on the SubmitChanges() where it complains that the datetime value is not set. No other errors are produced.

What am I doing wrong?

Was it helpful?

Solution

I see the error:

I should have used <- rather than = when assigning the value to newrec.Harvest_time.

I am new to F# (I am primarly a C# coder) and just made a silly misttake.

Program works fine now.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top