Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DataRow: Check for empty (Not "null) fields in DataSet

Hopefully this is an easy one. Is there a way to test for an "empty" field using DataRow? The following work fine for testing against a field with null values, unfortunately, the column I'm dealing with are either populated with data or are just "empty". Is there an approach in C# I'm missing? Thanks

if (Particle.Tables.Count == 0 || pDr.ItemArray[1].ToString() == "")
tblParticle.Append("No Data");
like image 305
John Kinane Avatar asked Jan 23 '26 06:01

John Kinane


1 Answers

you can use stirng.isNullorEmpty to check for empty fields. String.isNullorEmpty

if (Particle.Tables.Count == 0 || string.isNullorEmpty(pDr.ItemArray[1].ToString()))
{
   tblParticle.Append("No Data");
} 

.

like image 98
Ravi Gadag Avatar answered Jan 25 '26 18:01

Ravi Gadag



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!