Setting User Code Values

I’m working on a customisation for Shipping Dashboard. When one user is editing the records I want other users to be unable to access them so we don’t end up with the situation where one user overwrites another’s work. Right now I have a set of user codes which are doing the job of being company wide global variables. I can read from these user codes just fine but when I try to update them it seems like nothing is happening.

private void UpdateUserCodes()
{
    try
      {
	       UserCodesAdapter adapterUserCodes = new UserCodesAdapter(this.oTrans);
           adapterUserCodes.BOConnect();
       

	    SearchOptions opts = new SearchOptions(SearchMode.AutoSearch);
	    opts.PreLoadSearchFilter = "CodeTypeID = 'UD_SD'";
	    opts.DataSetMode = DataSetMode.RowsDataSet;
	    adapterUserCodes.InvokeSearch(opts);
	
		dtHolder = adapterUserCodes.UserCodesData.UDCodes;

		if (oTrans.CoreSession.PlantID == "HUL")
		{
		dtHolder.Rows[0][5] = email;
		dtHolder.Rows[1][5] = updateTime;
        dtHolder.Rows[2][5] = user;
		dtHolder.Rows[3][5] = locked;
		}

		if (oTrans.CoreSession.PlantID == "HAS")
		{
		dtHolder.Rows[4][5] = email;
		dtHolder.Rows[5][5] = updateTime;
        dtHolder.Rows[6][5] = user;
		dtHolder.Rows[7][5] = locked;
		}

		if (oTrans.CoreSession.PlantID == "DUN")
		{
		dtHolder.Rows[8][5] = email;
		dtHolder.Rows[9][5] = updateTime;
        dtHolder.Rows[10][5] = user;
		dtHolder.Rows[11][5] = locked;
		}
 	 adapterUserCodes.Dispose();
    }       
      catch (System.Exception ex)
       {
        MessageBox.Show(ex.ToString());
       }
}

The variables themselves are updating fine but for some reason this isn’t actually setting the values in that record position to the ones listed in the variables. Is it impossible to change the values within user codes or am I simply doing it wrong. Any help would be greatly appreciated.

Not really sure what you are trying to do but…
Am wondering if adding an update before disposing the adapter might help?

adapterUserCodes.Update();
adapterUserCodes.Dispose();`

That’s done the trick thanks. I should have probably guessed that it could take a .Update(). Seems so obvious in hindsight.