Reading and updating departments in Sage via Sage Data Objects is easy, and here's how.
Reading departments:
Dim IDepartment As SageDataObject50.Department
Dim strDescription As String
IDepartment = DirectCast(ws50.CreateObject("DepartmentData"), SageDataObject50.Department)
Dim i As Int16
For i = 0 To 100
IDepartment.Read(i)
strDescription = IDepartment.Fields.Item("NAME").Value.ToString()Me.lvDepartments.Items.Add(strDescription)
Next
To update them, you just use the write(int) method.
Dim IDepartment As SageDataObject50.Department
Dim strDescription As String
IDepartment = DirectCast(ws50.CreateObject("DepartmentData"), SageDataObject50.Department)
Dim i As Int16
For i = 0 To 100
IDepartment.Fields.Item("NAME").Value = "RESET"
IDepartment.Write(i)
Next