Link to home
Start Free TrialLog in
Avatar of Waterside
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..

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

Open in new window

Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Hi;

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
Avatar of Waterside
Waterside

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 :(
What do you want the results to look like?
Ah sorry, I missed of the start..

Private Function getDbLocations(roundId As Integer) As Dictionary(Of String, GeoCoordinate)

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Well spotted.  I forgot to change Dictionary to ListOf.. All is good now thanks'
thanks