Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6615153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:25:38+00:00 2026-05-25T20:25:38+00:00

I have a SQL table with about 380,000 rows. In SQL SMSS I perform

  • 0

I have a SQL table with about 380,000 rows.

In SQL SMSS I perform this query:

 SELECT Longitude, Latitude, street FROM [Stops].[dbo].[Members]   
 WHERE ABS(Latitude - 51.463419) < 0.005 AND ABS(Longitude - 0.099) < 0.005 

It returns about 20 results almost instantly.

I have a WCF webserice to expose my Data to my Windows phone application:

public class Service1 : IService1
{
    double curLatitude = 51.463;
    double curLongitude = 0.099;

    public List<Member> GetMembers()
    {
        DataClassesDataContext db = new DataClassesDataContext();
        var members = from member in db.Members                            
where (Convert.ToDouble(member.Latitude) - curLatitude) < 0.005 && (Convert.ToDouble(member.Longitude) - curLongitude) < 0.005

select member;
        return members.ToList();
    }
}

I beleive it is doing the same query, but also adding the items to a List.

The problem is, is that it takes 7+ minutes then I get some strange exception so never completes. The WCF service tester in VS2010 just fills up with memory and uses lots of CPU when permforming this.
My feeling is that the ToList is doing something odd?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:25:39+00:00Added an answer on May 25, 2026 at 8:25 pm

    You are missing the abs-part in your LINQ version.

    Some side notes.
    You can track the SQL query in at least two possible ways.

    1. Use SQL profiler and check the query there (then you can paste the query in SQL Management Studio and compare the output to your query above).
    2. Insert db.Log = Console.Out; (or another TextWriter) and check the output window in Visual Studio.

    You should dispose your DataClassesDataContext, the best way is to put it in a using block:

    public List<Member> GetMembers()
    {
        using(DataClassesDataContext db = new DataClassesDataContext())
        {
            var members = from member in db.Members                            
            where (Convert.ToDouble(member.Latitude) - curLatitude) < 0.005
                && (Convert.ToDouble(member.Longitude) - curLongitude) < 0.005
            select member;
            return members.ToList();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some SQL that gets a few details about a table. SELECT Column_Name,
I have a table on SQL Server 2005 that was about 4gb in size.
I have an SQL table like this : sales(product,timestamp) I want to display a
I have a MS SQL table with about 8 million records. There is a
I have a SQL table with indexes containing leads to call. About 30 users
I have a large mysql table (about 5M rows) on which i frequently insert
I have a SQL table, let's call it Table A, which has several rows
I have one sql table that looks like this called posts: id | user
I have an SQL table called "posts" that looks like this: id | category
I have a table about 10 million rows. We just imported it from another

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.