locked
STDistance method RRS feed

  • Question

  • Hi,

    Yesterday I made a stored procedure using STDistance method, which worked perfectly both in the .net code from where I called it and in SQL where I tested it.

    Today when I turned on my computer it doesn't perform the calculations any more. Just shows the points like names which are closest, but doesn't show the distance. And also, another stored procedure where I used STDistance method again, worked perfectly yesterday, now it doesn't calculate any more.

    Does anybody have an idea what could be the problem?

    Thank you very much in advance.

    Monday, February 28, 2011 9:30 PM

Answers

  • I solved the problem. Thank you very much anyway.
    Friday, March 4, 2011 9:54 AM

All replies

  • Without looking at your code, I've no idea how anybody can help tell you the problem! What does "Doesn't calculate any more" mean? Are you getting NULL? 0? An error message?!


    twitter: @alastaira blog: http://alastaira.wordpress.com/
    Monday, February 28, 2011 10:43 PM
    Answerer
  • Yes, now I get null. And since the first moment I wrote the code, everything worked perfectly. I didn't change the code at all in the application, niether in SQL. Now instead a calculated value, I get only NULL when testing the transact SQL in SQL Server Management Studio. I get this error when running the .net application:

    System.InvalidCastException: Object cannot be cast from DBNull to other types.

    (so, it shouldn't be null, it had a value before this happened, and the application worked good)

    Thanks.

    Tuesday, March 1, 2011 4:48 PM
  • And can you paste the T-SQL that's generating the null? Do the two instances which you're measuring the distance between have the same SRID?
    twitter: @alastaira blog: http://alastaira.wordpress.com/
    Wednesday, March 2, 2011 3:15 PM
    Answerer
  • I solved the problem. Thank you very much anyway.
    Friday, March 4, 2011 9:54 AM
  • So what was the problem (and the solution)? It would be helpful if you could share for anybody else who finds this issue in the future...
    twitter: @alastaira blog: http://alastaira.wordpress.com/
    Saturday, March 5, 2011 9:42 AM
    Answerer