string name = string.Empty;
for (int i = 0; i < dgvSupplier.Rows.Count; i++)
{
if (Convert.ToBoolean(dgvSupplier.Rows[i].Cells["CheckBoxColumn"].Value))
name += "'" + Convert.ToString(dgvSupplier.Rows[i].Cells["Title"].Value) + "',";
}
Now change where clause to "select db.date,db.type,db.refno,db.itmcod,db.qty,db.cuscod, db.cstcod,cus.cusnam INTO ##wec from fstktxn as db INNER JOIN fcustomer as cus on db.cuscod = cus.cuscod where itmcod IN (" + name + ")", conn1);