It's common to know if a dataset is empty, but I'm starting to get a little vague on the concept of DS empty, and I looked at it online, and the results are as follows: The dataset is empty and there are no tables in the dataset.
The dataset is empty, or a reference to a dataset type is null, meaning that the reference variable does not point to any new memory block.
Ds:dataset
if (ds = = null)//ds is empty
if (ds. Tables.count = = 0) No table in//ds
if (ds. Tables.count = = 1 && ds. Tables[0]. Rows.Count = = 0) The table in//ds has no data
We also need to determine if a table exists in the DS after we have determined if the DS is empty, and then we need to determine whether there is data in the table when using the table. The following is an example that determines whether a table exists in a dataset.
DataSet _ds = new DataSet ();
DataTable _dt = new DataTable ("TableName");
_ds. Table.add (_DT);
if (_ds! = null)
{
if (_ds. Tables.contains (_dt. TableName)
{
Presence Table
}
}
Determine if the dataset is empty and whether there are tables in the dataset and whether there is data in the table