Imagine that only one row in SQL Table can be primary key so all others can't

I need to check if the data type is int or bigint and enable to check the PK collumn.
When i check the PK for one row the previous checked needs to be unchecked.
i tried with this code
For i = 0 To dgv.Rows.Count - 1 If dgv.Rows(i).Cells("PK").Value Then For j = 0 To i - 1 dgv.Rows(j).Cells("PK").Value = False Next For x = i To dgv.Rows.Count - 1 dgv.Rows(x).Cells("PK").Value = False Next End If Next
It should work fine but the problem is when i click on other row without checking the PK cell it reset the previous one.
For loop to uncheck the rows to selected one
For loop to uncheck the rows from selected one to max.