dimanche 13 mars 2016

Asp.net data table returns row count as 1 even though data table is null(in case of aggregate functions only)

I have been trying to execute a particular function if data table rows count >0 but in my code it returns 1 even though data table is null . my code is..

 c.cmd.CommandText = "select sum(qty) from product where seller_id=" +Convert.ToInt64( Session["seller_id"]) + "";
        adp.SelectCommand = c.cmd;
        dt1.Clear();
        adp.Fill(dt1);
        MessageBox.Show(dt1.Rows.Count.ToString()); 

someone help please...

Aucun commentaire:

Enregistrer un commentaire