Wednesday, May 4, 2016

to find dataset has the records or not and to count the no. of records in the dataset

 bool datafound = false;
                // to check whether the data is there or not and no of rows in a dataset
                int count = 0;
                if (dsSMSJob != null && dsSMSJob.Tables.Count > 0)
                {
                    foreach (System.Data.DataTable table in dsSMSJob.Tables)
                    {
                        if (table.Rows.Count > 0)
                        {
                            count = count + table.Rows.Count; // no. of records in dataset
                            datafound = true; // data is there
                        }
                    }
                }
                if(datafound==true)
                    sendSMS(dsSMSJob, job);     // if the data is there do some operation

No comments:

Post a Comment