VB.NET Upgrade ODtable error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
I am try to Upgrade ODtable I get this error
Autodesk.Gis.Map.MapException: Exception of type 'Autodesk.Gis.Map.MapException' was thrown.
Public Sub odTablesinsert(ByVal id, ByVal Category, ByVal Materials) Dim doc As Autodesk.AutoCAD.ApplicationServices.Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument Dim db As Database = doc.Database Dim Ed As Editor = doc.Editor Dim trans As Transaction = db.TransactionManager.StartTransaction() Dim odTable As Autodesk.Gis.Map.ObjectData.Table Dim odTables As Autodesk.Gis.Map.ObjectData.Tables Dim mapVal As Autodesk.Gis.Map.Utilities.MapValue odTables = HostMapApplicationServices.Application.ActiveProject.ODTables odTable = odTables.Item("TABLE_NAME") Try Using docloc As DocumentLock = doc.LockDocument Dim dbObj As DBObject = trans.GetObject(id, Autodesk.AutoCAD.DatabaseServices.OpenMode.ForWrite) Dim odrecords As ObjectData.Records = odTable.GetObjectTableRecords(Convert.ToUInt32(0), id, Constants.OpenMode.OpenForRead, False) Dim odRecord As ObjectData.Record = odrecords.Item(0) odRecord = Autodesk.Gis.Map.ObjectData.Record.Create() odTable.InitRecord(odRecord) If odrecords.Count = 0 Then Ed.WriteMessage("New" & vbCr) mapVal = odRecord(0) mapVal.Assign(Category) mapVal = odRecord(1) mapVal.Assign(Materials) odTable.AddRecord(odRecord, dbObj) Else Ed.WriteMessage("Update" & vbCr) mapVal = odRecord(0) mapVal.Assign(Category) mapVal = odRecord(1) mapVal.Assign(Materials) odrecords.UpdateRecord(odRecord) <<< ERROR End If odRecord.Dispose() odrecords.Dispose() trans.Commit() End Using Catch exc As Autodesk.Gis.Map.MapException MsgBox("Error : " + exc.Message.ToString()) End Try End Sub
Link copied