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 153321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:46:50+00:00 2026-05-11T09:46:50+00:00

I am trying to issue a SQL update statement with nHibernate (2.0.1GA) like this:

  • 0

I am trying to issue a SQL update statement with nHibernate (2.0.1GA) like this:

sqlstring = string.Format('set nocount on;update myusers set geo=geography::Point({0}, {1}, 4326) where userid={2};', mlat, mlong, userid); _session.CreateSQLQuery(sqlstring).ExecuteUpdate(); 

However I receive the following error: ‘geography@p0’ is not a recognized built-in function name.

I thought CreateSQLQuery would just pass the SQL I gave it and execute it…guess not. Any ideas on how I can do that within the context of nHibernate?

  • 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. 2026-05-11T09:46:51+00:00Added an answer on May 11, 2026 at 9:46 am

    I’m pretty sure I can tell you what is happening, but I don’t know if there is a fix for it.

    I think the problem is that the ‘:’ character is used by NHibernate to create a named parameter. Your expression is getting changed to:

    set nocount on;update myusers set geo=geography@p0({0}, {1}, 4326) where userid={2}; 

    And @p0 is going to be a SQL variable. Unfortunately I can’t find any documentation for escaping colons so they are not treated as a named parameter.

    If an escape character exists (my quick skim of the NHibernate source didn’t find one; Named parameters are handled in NHibernate.Engine.Query.ParameterParser if you want to spend a little more time searching), then you could use that.

    Other solutions:

    • Add an escape character to the source. You can then use a modified version of NHibernate. If you do this, you should submit your patch to the team so it can be included in the real thing and you don’t have to maintain a modified version of the source (no fun).
    • Create a user defined function in your DB that returns a geography::Point, then call your function instead of the standard SQL function. This seems like the quickest/easiest way to get up and running, but also feels a bit like a band-aid.
    • See if there is something in NHibernate Spatial that will let you programmatically add the geography::Point() [or edit the code for that project to add one and submit the patch to that team].
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 75k
  • Answers 75k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Yes a windows service can and does work in the… May 11, 2026 at 2:38 pm
  • added an answer As ever, Ryan Bates has a Railscast on this very… May 11, 2026 at 2:38 pm
  • added an answer Without using GO, programmatically, you would need to make 2… May 11, 2026 at 2:38 pm

Related Questions

Because I am a newbie I am trying to log out any errors that
This has happened to me 3 times now, and I am wondering if anyone
I am trying to paginate the results of an SQL query for use on
I am trying to capture the output of a SQL query in MySQL, to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.