Change your query to include count of occurrence using
, if possible.
Then you can directly use
If (e.Row.DataItem("occurrence") > 1) Then
e.Row.BackColor = Drawing.Color.Red
Otherwise, you need to loop through rows, and check whether it is duplicate or not and set the