How To Compare Column Value Of a DataTable

Hello, all. I need advice to you. I got stuck on comparing two value from a single DataTable after some preprocess.

  1. The table from spreadsheet, this about monthly payment.

  2. After pre-preocess I could get the column I wanted
    getMonth

the code I made to get the result as the out picture above was like this

//get the total column in DataTable
repeatColumn = dtPO.Columns.Count //DataType int

//assign the counter in while
countColumn = 0 //the increment variable DataType int

while(countColumn<repeatColumn-1){

countColumn = countColumn+1 // DataType int

//get the header column
nameColumn = dtPO.Colomns(countColumn).ToString

if(nameColumn.Contains(currentMonth)){
for each row in dtPO{
//the code below still error due to null
// valueInside = cint(row(countColumn))

  	//WriteLine using just for check the value 
  	WriteLine("Nilai dalam for each row " + row(nameColumn).ToString)
  }

}else{
//using for debugging only
WriteLine(“not contains current month” + row(nameColumn).ToString)
}

}

My problem is to compare the Aug 2020 and Actual Aug 2020 value. Your oppinions mean so much for me. Thx in advance.

@kristoff

Check as below

Take two columns value to a variable, and you can compare both values

Hope this helps

Thanks

@ksrinu070184, I think I got your poin. Thanks a lot

1 Like

@kristoff

Mark as solution if this helps

Thanks

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.