Call UD adapter with where clause

Hi,

Can someone help me with script, I need to get UD table record where CheckBox01 == false
UD would contain for example PartNum 123 in many rows, but there always would be only one row where CheckBox == false, so I need to get this line for editing and setting CheckBox01 == true.
At the moment I have this, but how to filter rows by checkbox01?

private void CallUD3AdapterGetByIDMethod(string Key1, string Key2, string Key3)
	{
		try
		{
			// Declare and Initialize EpiDataView Variables
			// Declare and create an instance of the Adapter.
			UD03Adapter adapterUD03 = new UD03Adapter(this.oTrans);
			adapterUD03.BOConnect();

			// Declare and Initialize Variables
			// TODO: You may need to replace the default initialization with valid values as required for the BL method call.

			// Call Adapter method

		adapterUD03.GetByID(Key1, Key2, Key3, "", "");
		//DataRow dr = adapterUD02.UD02Data.UD02.Rows[0]["Character01"].ToString();
		DataRow dr = adapterUD03.UD03Data.UD03.Rows[0];
			dr.BeginEdit(); 
			dr["CheckBox01"] = true;
			dr["Number01"] = rOnHand;
			dr["Number02"] = tNewQty;
			dr["Date01"] = DateTime.Today;
			dr["RowMod"] = "U";
			dr.EndEdit(); 
 		bool resultUpdate = adapterUD03.Update();
		//MessageBox.Show(dr);


			// Cleanup Adapter Reference
			adapterUD03.Dispose();

		} catch (System.Exception ex)
		{
			ExceptionBox.Show(ex);
		}
	}

Did you look at this? Might help you out.

or here.

1 Like

GetByID doesnt seem to be the right call for this.

You need to call GetRows or GetList with a proper where clause (ala CheckBox01 = true).

Then you get your resulting data, modify it, then call adapter.Update()

1 Like