error CS1977: Cannot use a lambda expression as an argument to a dynamically dispatched operation

Viewed 7373

I've converted some code from vb.net to c# but it's having problems with a lambda.

error CS1977: Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type.

Here's the translated code..

dynamic ds = (JArray)o["Tables"][0]["Rows"];
using(var connection = new SqlConnection(cnnString))
    {connection.Open();
     ds.Select(ja =>
        connection.Execute("INSERT INTO dbo.AddPlay(UserId, Timestamp, YoutubeId, Source, PlayCount, Rating) " + 
                " VALUES(ja(0).Value<string>(), ja(1).Value<string>() ja(2).Value<string>(), ja(3).Value<string>(), GetInt(ja(4)), GetInt(ja(5)))"));
    }
2 Answers
Related