AddOrUpdate Method
- Last UpdatedNov 06, 2025
- 3 minute read
The AddOrUpdate() method update the user name record in the User_Name table if the record already exists or add a new user name record in the User_Name table if it does not exist.
'Declaration
Public Shared Sub AddOrUpdate( _
ByVal sessionId As Integer, _
ByVal userId As String, _
ByVal userDesc As DBString, _
ByVal encryptPassword As String, _
ByVal active As Nullable(Of Boolean), _
ByVal hourlyCost As DBDouble, _
ByVal langId As Nullable(Of Integer), _
ByVal defaultDeptId As DBString, _
ByVal authMethod As Nullable(Of Integer), _
ByVal defaultLabCd As DBString, _
ByVal spare1 As DBString, _
ByVal spare2 As DBString, _
ByVal spare3 As DBString, _
ByVal spare4 As DBString, _
ByVal lastEditComment As DBString, _
ByVal lastEditAt As Date, _
ByRef modId As String _
)
'Usage
Dim sessionId As Integer
Dim userId As String
Dim userDesc As DBString
Dim encryptPassword As String
Dim active As Nullable(Of Boolean)
Dim hourlyCost As DBDouble
Dim langId As Nullable(Of Integer)
Dim defaultDeptId As DBString
Dim authMethod As Nullable(Of Integer)
Dim defaultLabCd As DBString
Dim spare1 As DBString
Dim spare2 As DBString
Dim spare3 As DBString
Dim spare4 As DBString
Dim lastEditComment As DBString
Dim lastEditAt As Date
Dim modId As String
UserName.AddOrUpdate(sessionId, userId, userDesc, encryptPassword, active, hourlyCost, langId, defaultDeptId, authMethod, defaultLabCd, spare1, spare2, spare3, spare4, lastEditComment, lastEditAt, modId)
public static void AddOrUpdate(
int sessionId,
string userId,
DBString userDesc,
string encryptPassword,
Nullable<bool> active,
DBDouble hourlyCost,
Nullable<int> langId,
DBString defaultDeptId,
Nullable<int> authMethod,
DBString defaultLabCd,
DBString spare1,
DBString spare2,
DBString spare3,
DBString spare4,
DBString lastEditComment,
DateTime lastEditAt,
ref string modId
)
Parameters
- sessionId
Required. Holds the session ID and thus the user who is making this method call.
- userId
Required. Holds the ID of the user. For example, the employee number or name of the employee.
- userDesc
- [Optional]A string which describes the user (e.g. the employee name)
- encryptPassword
Optional. Holds the password of the user in the encrypted format if a new user name record is added. This parameter is not used for updating an existing record.
- active
Optional. Holds a flag that, if set to true, specifies that the state of the user is active in the MES system.
- hourlyCost
- Optional. Holds the cost of the labour per hour.
- langId
- Optional. Holds the ID of the user's preferred language.
- defaultDeptId
- Optional. Holds the default department ID of the user.
- authMethod
- Optional. Holds the authentication method. The value 0 indicates "Internal" and 1 indicates "Windows (future)".
- defaultLabCd
- Optional. Holds the default labor code of the user.
- spare1
- Optional. Holds the contents of the user-defined spare1 field.
- spare2
- Optional. Holds the contents of the user-defined spare2 field.
- spare3
- Optional. Holds the contents of the user-defined spare3 field.
- spare4
- Optional. Holds the contents of the user-defined spare4 field.
- lastEditComment
- Optional. Holds comments that describe why this record is being added.
- lastEditAt
- Output. Holds the returned date/time when this record was added, for optimistic concurrency control. The lastEditAt parameter is used by other methods that modify or delete this type of record for optimistic concurrency control.
- modId
- Output. Holds the modification ID assigned to this record when it is added. The modId parameter is used by other methods that modify or delete this type of record for optimistic concurrency control.
Observe the following input parameter rules:
- Required non-DB* parameters: Must pass a value. Cannot be empty or null.
- Optional non-DB* parameters: Either enter a value or pass a null. If passing a null and a default value has been defined, the default value will be used for the parameter.
- Required DB* parameters: Must pass a value. To enter an empty value for the parameter, pass DB*.null (e.g., DBInt.null).
- Optional DB* parameters: To enter no value for the parameter, pass DB*.null (e.g., DBInt.null). To use the default value for the parameter if one has been defined for the object being added, pass a null.