SQL Server Developer Center >
SQL Server Forums
>
SQL Server Spatial
>
How to create SQL Geography type in C#
How to create SQL Geography type in C#
- Hello,
How do I create a geography type point using C#. I am looking for some examples, blogs etc for compact framework. I was looking at :
http://jasonfollas.com/blog/archive/2008/12/11/using-ado.net-with-sql-server-spatial-objects.aspx but there are 2 problems-
1) If I add Microsoft.SqlServer.Types in my windows mobile project as a reference and debug, the project starts deploying 20 different dlls like system.web etc onto device and the app folder becomes huge in size and device runs out of memory. Is there a CF version of this dll that I can add as a reference?
2) There is no property for UDTName for sqlceParameter
I would really appreciate if someone can help me out with this!
Thanks
Apurva
Answers
- I've already posted the answer to this question in your other threads but the answer to the question is "no." The mentions of the geography types that you saw in the SQL Server Compact 3.5 documentation were in reference to SQL Server 2008. When data of that type is replicated to an SQL Server Compact 3.5 database it is mapped to the image data type. More information on that can be found here:
http://msdn.microsoft.com/en-us/library/ms171931.aspx
The assembly to which you added a reference was a desktop assembly and resulted in the desktop version of the .Net framework being deployed to your device; that's pretty useless since your device can't use the desktop version of the framework.
Joel Ivory JohnsonIt takes all the running you can do to stay in one place.If you want to get somewhere else,you must try to run at least twice as fast as that.- Proposed As Answer byJoel Ivory Johnson Monday, October 26, 2009 8:57 PM
- Marked As Answer byChunSong Feng -MSFTMSFT, ModeratorFriday, October 30, 2009 11:41 AM
- There are a couple of ways to do this. A some good examples can be found here: http://blogs.msdn.com/davidlean/archive/2008/10/30/sql-2008-spatial-samples-part-n-5-of-n-sql-builder-api.aspx however they are in VB. This isn't that big of an issue, you can always us an online tool to convert the VB to c#: http://www.developerfusion.com/tools/convert/csharp-to-vb/
As for using it with CF. I would't recommend it. Your best option is to create a web service and have that do all the processing and only return the information you need.
Windows Live Developer MVP - http://rbrundritt.spaces.live.com- Marked As Answer byChunSong Feng -MSFTMSFT, ModeratorFriday, October 30, 2009 11:41 AM
All Replies
- I've already posted the answer to this question in your other threads but the answer to the question is "no." The mentions of the geography types that you saw in the SQL Server Compact 3.5 documentation were in reference to SQL Server 2008. When data of that type is replicated to an SQL Server Compact 3.5 database it is mapped to the image data type. More information on that can be found here:
http://msdn.microsoft.com/en-us/library/ms171931.aspx
The assembly to which you added a reference was a desktop assembly and resulted in the desktop version of the .Net framework being deployed to your device; that's pretty useless since your device can't use the desktop version of the framework.
Joel Ivory JohnsonIt takes all the running you can do to stay in one place.If you want to get somewhere else,you must try to run at least twice as fast as that.- Proposed As Answer byJoel Ivory Johnson Monday, October 26, 2009 8:57 PM
- Marked As Answer byChunSong Feng -MSFTMSFT, ModeratorFriday, October 30, 2009 11:41 AM
- There are a couple of ways to do this. A some good examples can be found here: http://blogs.msdn.com/davidlean/archive/2008/10/30/sql-2008-spatial-samples-part-n-5-of-n-sql-builder-api.aspx however they are in VB. This isn't that big of an issue, you can always us an online tool to convert the VB to c#: http://www.developerfusion.com/tools/convert/csharp-to-vb/
As for using it with CF. I would't recommend it. Your best option is to create a web service and have that do all the processing and only return the information you need.
Windows Live Developer MVP - http://rbrundritt.spaces.live.com- Marked As Answer byChunSong Feng -MSFTMSFT, ModeratorFriday, October 30, 2009 11:41 AM


