Message 1 of 10
How to add information to a table that already has information in it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone.
As per the title of the post, I need to add new information to an existing table which already contains information. I tried this code but it doesn't add the new information and it doesn't give me any errors.
Private Sub B_OK_Click(sender As Object, e As EventArgs) Handles B_OK.Click
Dim Dwg_Doc = Application.DocumentManager.MdiActiveDocument
Dim Dwg_DB = Dwg_Doc.Database
Try
Using Trans_Write_Dict = Dwg_DB.TransactionManager.StartTransaction()
Dim NOD = CType(Trans_Write_Dict.GetObject(Dwg_DB.NamedObjectsDictionaryId, OpenMode.ForRead), DBDictionary)
Dim Dict As DBDictionary
Dim Info As New ResultBuffer
If NOD.Contains("Named_Obj_Dict") Then
Dict = CType(Trans_Write_Dict.GetObject(NOD.GetAt("Named_Obj_Dict"), OpenMode.ForWrite), DBDictionary)
Dim XRec_Existing_Info As Xrecord = CType(Trans_Write_Dict.GetObject(Dict.GetAt("Informations"), OpenMode.ForWrite), Xrecord)
Dim XRec_Existing_Info_Data = XRec_Existing_Info.Data
Dim XRec_New_Info As Xrecord = New Xrecord
XRec_New_Info = CType(Trans_Write_Dict.GetObject(Dict.GetAt("Informations"), OpenMode.ForWrite), Xrecord)
For a As Integer = 0 To XRec_Existing_Info_Data.AsArray.Count - 1
Info.Add(New TypedValue(1, XRec_Existing_Info_Data.AsArray(a).Value.ToString))
Next
Info.Add(New TypedValue(1, TB1.Text))
Info.Add(New TypedValue(1, TB2.Text))
Info.Add(New TypedValue(1, TB3.Text))
Info.Add(New TypedValue(1, CB1.Text))
Info.Add(New TypedValue(1, CB2.Text))
XRec_New_Info.Data = Info
Trans_Write_Dict.Commit()
Else
MsgBox("Error! The NOD does not exist", MsgBoxStyle.Exclamation)
Me.Close()
End If
End Using
Me.Close()
Catch ex As Exception
MsgBox("General error!!!", MsgBoxStyle.Critical, "Error!!!")
End Try
End Sub
Where do you think I'm wrong?
Thank you all very much, bye.