Declare a
StringBuilder
.
Loop through the rows of
GridView
.
Inside the Loop, get the Column Value you want and append that to the
StringBuilder
.
After the loop, execute one query like
"SELECT something FROM TableName WHERE Id in (" + objStrBuilder + ")";