데이터 집합에서 중복 행을 확인하는 방법은 무엇입니까?
중복 행이있을 때 실행할 내 오류 메시지를 원하는 중복 행이있는 데이터 집합이 있습니다.
다음은 당신이 당신에게 논리를 조금 변경하는 생각
DataSet dsXml = new DataSet();
dsXml.ReadXml(new XmlTextReader(new StringReader(xml)));
Hashtable hTable = new Hashtable();
ArrayList duplicateList = new ArrayList();
foreach (DataRow drow in dsXml.Tables[0].Rows)
{
if (hTable.Contains(drow))
{
duplicateList.Add(drow);
}
else
{
script.Append("alert('Error - There are some Duplicate entries.'); ");
ErrorOcc = true;
if (ErrorOcc)
{
this.ScriptOutput = script + " ValidateBeforeSaving = false;";
this.StayContent = "yes";
return;
}
}
}
도움이 더 필요하십니까? 그렇지 않은 경우 대답으로 표시하여이 질문을 닫으십시오. –