Hello all...

I'm trying to populate a Flexgrid using an SQL query that involves values external to the database being queried.
The database contains latitudes and longitudes of points of interest on Earth.
Ie.
Point A, -43.5644,-79.5432
Point B, -89.5433, 76.3343
Point C, 54.6433 , 65.4432


What I want to do is enter a latitude and longitude of a central location (ie. my car), calculate the distance from that location to each of the points of interest located in the database and populate the Flex Grid with only those points that are located within a certain distance from that central location.
I would have no problems doing this if the central location was fixed, but dynamic central location makes it a little tricky.

Can this be done using an SQL query do do I have to try other magic to make this work?

Thanks for any help!

Try to use a listview control. This way you can add data AND external values. Something like -

Do Until rs.EOF
        Set list = ListView1.ListItems.Add(, ,rs!RecordNumber)
    lista.ListItems.SubItems(1) = rs!DataLocation1
    lista.ListItems.SubItems(2) = rs!DataLocation2
    lista.ListItems.SubItems(3) = strPointA
    lista.ListItems.SubItems(4) = strPointB 'and so on...

            rs.MoveNext
    Loop

Thank You AndreRet...

I have never used this control in the past but I did some research on it last night and it surely paid off! It works wonderfully...
I even got to a point where I replaced other parts in the software with Listview and it saved me a bit of code space... and spared a lot of headaches.

thanks once again!

It was only a pleasure.:)

Happy coding.;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.