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

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


countColumn = countColumn+1 // DataType int

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

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)

//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.


Check as below

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

Hope this helps


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

1 Like


Mark as solution if this helps


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