//Dataset Itself can not contains Rows and coloumns . //Dataset will contain Datatable in it . //and in that datatable (dt) we will check the number of rows in datatable Bool IsExist = false ; for (int i = 0;i < ds.Tables[0].rows.count;i++) { if(ds.Tables[0].rows[i].contains("TEST")) { IsExist = true ; } }
//Sample code int TotalCount = 0; int MatchedCount = 0; DataRow[] drMatched; drMatched = dataSet1.Tables["Employee"].Select("EmpName Like 'TEST%'"); TotalCount = dataSet1.Tables["Employee"].Rows.Count; MatchedCount = drMatched.Length; if(TotalCount != MatchedCount) { //if code } else { //else code }
If ds.Tables.Count > 0 Then If ds.Tables(0).Rows.Count > 0 Then For Each row As DataRow In ds.Tables(0).Rows If row("EMPName") = "TEST" Then Return Else End If Next End If Else End If
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)