New Posts New Posts RSS Feed: Sql Server 2008 Geography Data Type
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Sql Server 2008 Geography Data Type

 Post Reply Post Reply
Author
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Topic: Sql Server 2008 Geography Data Type
    Posted: 25-May-2012 at 6:44pm
DevForce Classic does not directly support spatial data, but you can work around the limitation.
 
Instead of defining the data column as a Geography type you can use varbinary(max), so that DevForce can read and write the column.  Within your code you can then convert the byte array to a SqlGeography type when needed.
 
For example, when saving you can use STAsBinary to obtain the byte array to be saved in the database column.  For example:
    myEntity.MyGeoAsBinaryProp = mygeogVar.STAsBinary().Buffer
 
To create a SqlGeometry object from a queried entity you can use something like this:
  Dim sqlBytes = New SqlBytes(myEntity.MyGeoAsBinaryProp)
  Dim geog = SqlGeography.STGeomFromWKB(sqlBytes, mysrid)
 
 
 
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 25-May-2012 at 10:24am
Himstevenson,
 
I've moved this post to DevForce Classic instead.
 
Silvio.
Back to Top
mstevenson View Drop Down
Newbie
Newbie


Joined: 25-May-2012
Posts: 1
Post Options Post Options   Quote mstevenson Quote  Post ReplyReply Direct Link To This Post Posted: 25-May-2012 at 3:55am
Is DevForce classic 3.7.6 compatible with Sql Server 2008 spatial data types? I get the following error when I include geography database column in the Object Mapper.
IdeaBlade.Persistence.PersistenceManagerSaveException was caught
  Message=Save failed - Operand type clash: image is incompatible with geography
  Source=IdeaBlade.Persistence
  StackTrace:
       at IdeaBlade.Persistence.PersistenceManager.DoSaveDataSet(IEnumerable pDataRows, SaveOptions pSaveOptions)
       at Model.IRWPersistenceManager.SaveChanges() in C:\Model\IRWPersistenceManager.vb:line 339
       at UI.SavingService.SaveAll() in C:\UI\BaseClasses\SavingService.vb:line 39
  InnerException: System.Data.OleDb.OleDbException
       ErrorCode=-2147217913
       Message=Operand type clash: image is incompatible with geography
       Source=Microsoft OLE DB Provider for SQL Server
       StackTrace:
            at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
            at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
            at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
            at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
            at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
            at IdeaBlade.Persistence.Server.TransactionManagerHelper.SaveTable(EntityTable pTable, Boolean pDeleting, PostSaveHandler pPostSaveHandler, Boolean pExcludeFromRefetch)
            at IdeaBlade.Persistence.Server.TransactionManagerHelper.Save(DataSet pDataSet, SaveOptions pSaveOptions)
       InnerException:
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down