foreach (Selected s1 in objlistCropped)
{
string strImg2 = s1.Image;
if (strImg1 == strImg2)
{
dtPreInstallation.Rows.Add(strImg2, s.strText);
}
}
strImg1 = Img1.Jpeg,
I need to restrict adding img1.jpeg again if its already there in datatable.
Thanks in Advance
How to prevent insertions of duplicate record into datatable
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Akhil GargRank #772 · 3K reputationPosted Jan 21, 2015, 5:28 AM EST
dtPreInstallation.Select("Dtcolname = '" + strImg1+"'");
It will return array of DataRow so if count of element in array is greater than 0 then that string name is already present else you can add new row