Waterside
asked on
LinqToSQL Range variable name can be inferred only from a simple or qualified name with no arguments
I am trying combine two columns (latitude and longitude) into a new coordinate using linqToSQL, but I get the error..
Range variable name can be inferred only from a simple or qualified name with no arguments
Here is my code..
Range variable name can be inferred only from a simple or qualified name with no arguments
Here is my code..
Using dc = New Context(ConnectionString)
Dim data = From d In dc.Routes Where routeId = routeId Select d.PlaceName, New GeoCoordinate(d.Latitude, d.Longitude)
Return data.ToList
End Using
ASKER
That fixes the query def but breaks data.ToList as it is returning an anonymouse type.
I had hoped that LatLong As GeoCoordinate might have helped, but no :(
I had hoped that LatLong As GeoCoordinate might have helped, but no :(
What do you want the results to look like?
ASKER
Ah sorry, I missed of the start..
Private Function getDbLocations(roundId As Integer) As Dictionary(Of String, GeoCoordinate)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Well spotted. I forgot to change Dictionary to ListOf.. All is good now thanks'
ASKER
thanks
Try it like this.
Using dc = New Context(ConnectionString)
Dim data = From d In dc.Routes Where routeId = routeId Select d.PlaceName, LatLong = New GeoCoordinate(d.Latitude, d.Longitude)
Return data.ToList
End Using