LaborDtl returns 0

Hi all , i am trying to pull data from my labordtl table , but no matter how i change my code , it will return zero(only table name available ).

private  void UpdateDatabase()
{
try
{
int rowUpdate = 0;
 using (LaborAdapter laborAdapter = new LaborAdapter(this.oTrans))
                    {
                        laborAdapter.BOConnect();

                        // Get the dataset from the adapter
                        LaborDataSet dataset = laborAdapter.LaborData;

                        // Apply the WHERE condition
                        LaborDataSet.LaborDtlRow[] selectedRows = 
                            (LaborDataSet.LaborDtlRow[])dataset.LaborDtl.Select("LaborType='I'");

                        foreach (LaborDataSet.LaborDtlRow row in selectedRows)
                        {
                            rowUpdate++;
                            row.JobNum = "NewValue"; // Replace with the field you want to update
                        }

                        // Update the changes
                    //    laborDtlGroupAdapter.Update(dataset);

                        laborAdapter.Dispose();
                    }

System.Windows.Forms.MessageBox.Show(rowUpdate.ToString(), "Done");
}
catch(Exception e){
System.Windows.Forms.MessageBox.Show(e.Message.ToString(), "Done");
}
}

I would like to know if you got the code from the system customization screen or the one you created yourself?
You can use this method to generate your own code to get the data and then edit it to your liking

You can use Business Logic Method Call or Simple Search




here is the generated code:
You edit opts to get according to the condition you want to get out

private void CallLaborAdapterGetListMethod()
	{
		try
		{
			// Declare and Initialize EpiDataView Variables
			// Declare and create an instance of the Adapter.
			LaborAdapter adapterLabor = new LaborAdapter(this.oTrans);
			adapterLabor.BOConnect();

			// Declare and Initialize Variables
			// TODO: You may need to replace the default initialization with valid values as required for the BL method call.
			Ice.Lib.Searches.SearchOptions opts = null;
			bool morePages = false;

			// Call Adapter method
			System.Data.DataSet dsLabor = adapterLabor.GetList(opts, out morePages);

			// Cleanup Adapter Reference
			adapterLabor.Dispose();

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

Good luck! Have a good day! :smiling_face_with_three_hearts: :smiling_face_with_three_hearts:

1 Like