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

  • Home
  • SEARCH
  • 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 6023259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:58:40+00:00 2026-05-23T03:58:40+00:00

I apologise for asking just a basic question, however I cannot find the cause

  • 0

I apologise for asking just a basic question, however I cannot find the cause of this error.

I am using Entity Framework to execute a Stored Procedure, and I am passing in four parameters, however the SQL Database seems to reject them. Can anyone point me in the right direction?

My code:

ObjectResult<SearchDirectoryItem> resultList = container.ExecuteStoreQuery<SearchDirectoryItem>("SearchDirectoryEntries",
            new SqlParameter("@DirectoryId", search.DirectoryId),
            new SqlParameter("@Latitude", point.Latitude),
            new SqlParameter("@Longitude", point.Longitude),
            new SqlParameter("@Range", search.RangeMiles));

Which produces the error:

Procedure or function ‘SearchDirectoryEntries’ expects parameter ‘@DirectoryId’, which was not supplied.

The SQL generated is:

exec sp_executesql N'SearchDirectoryEntries',N'@DirectoryId int,@Latitude decimal(7,5),@Longitude decimal(6,5),@Range int',@DirectoryId=3,@Latitude=53.36993,@Longitude=-2.37013,@Range=10

The stored procedures is:

ALTER PROCEDURE [dbo].[SearchDirectoryEntries]
@DirectoryId int,
@Latitude decimal(18, 6),
@Longitude decimal(18, 6),
@Range int

Many Thanks.

  • 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-23T03:58:41+00:00Added an answer on May 23, 2026 at 3:58 am

    The commandText param in your query is incorrect. It should be a call to a stored procedure with parameters instead of just stored procedure name:

    ObjectResult<SearchDirectoryItem> resultList = container.ExecuteStoreQuery<SearchDirectoryItem>(
        "Exec SearchDirectoryEntries @DirectoryId, @Latitude, @Longitude, @Range",
         new SqlParameter("DirectoryId", search.DirectoryId),
         new SqlParameter("Latitude", point.Latitude),
         new SqlParameter("Longitude", point.Longitude),
         new SqlParameter("Range", search.RangeMiles));
    

    Also don’t forget to remove ‘@’ from SqlParameter constructor.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is extremely basic and I apologize for asking such a rookie question. But
Hey guys, I can only apologise for asking such a noob question, but this
I apologise in advance if this question isn't very specific. Would it be possible
I apologise if this has been asked before but I can't find the info
I realized, when just asking a question, I don't understand all the components that
apologies for not asking a strictly programming question, but this will move on to
Apologies for asking more or less the same question again. I just noticed that
I'm asking a question very similar to this one —dare I say identical? An
this is my first time asking a question here so apologies if I am
I tried enough to find in google & android this question. Also did several

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.