c# - How to check a value in dataset is empty or not? -


i have fileupload option in project. inclueds query returns dataset. works fine. want check whether returning dataset is empty or same value passed parameter query. here end code.

.cs code

if ((fileupload1.hasfile))//&& (ext == ".pdf") {     ds = db.checkexistingpdf(filename);     if (dbfilename != filename)     {          this.fileupload1.saveas(path.combine(svrpath, filename + ".pdf"));          scriptmanager.registerstartupscript(this, this.gettype(), "message", " alert('successfully uploaded');", true);                         }     else     {          scriptmanager.registerstartupscript(this, this.gettype(), "message", " confirm ('appeal availbale competition') ; ", true);       }     else {     scriptmanager.registerstartupscript(this, this.gettype(), "message", " confirm ('error') ; ", true); } 

here query

public dataset checkexistingpdf(string filename) {     string strquery = @"if exists (select * appeal_master attachment_upload = '"+ filename +"')";      return sqlhelper.executedataset(strconnstringappeal, commandtype.text, strquery); } 

to check dataset empty or not have check null , tables count.

dataset ds=checkexistingpdf("filename"); if(ds != null && ds.tables.count > 0) {  // code } 

Comments