我有一个搜索关键字然后返回DataTable的函数.我想检查里面是否有行,因为有时候找不到查询.
'which one shoud I use ? If dtDataTable Is Nothing Then 'some code lbl_count.Text = "Found 0 result" End If If dtDataTable.Rows.Count > 0 Then 'some code lbl_count.Text = "Found " & dtDataTable.Rows.Count.ToString & " results" End If
谢谢.
怎么样:
原文链接:/vb/255593.htmlIf dtDataTable IsNot Nothing AndAlso dtDataTable.Rows.Count > 0 Then 'some code lbl_count.Text = "Found " & dtDataTable.Rows.Count.ToString & " results" Else 'some code lbl_count.Text = "Found 0 result" End If