Check this test query. Now please take its reference and correct your code. You need to call this in your code to populate the GridView.
SQL
DECLARE @Test AS TABLE(Sno INT,Status VARCHAR(10),FromDate DATETIME,ToDate DATETIME)
INSERT INTO @Test VALUES(1,'Pending','02/20/2017','02/26/2017')
INSERT INTO @Test VALUES(2,'Hold','01/10/2017','01/25/2017')
INSERT INTO @Test VALUES(3,'Completed','02/21/2017','02/26/2017')
INSERT INTO @Test VALUES(4,'Completed','02/22/2017','02/28/2017')
INSERT INTO @Test VALUES(5,'Hold','01/15/2017','01/30/2017')
INSERT INTO @Test VALUES(6,'Pending','01/20/2017','02/22/2017')
DECLARE @DateTime DATETIME
SET @DateTime = '02/25/2017'
SELECT
(SELECT COUNT(*) FROM @Test WHERE @DateTime BETWEEN FromDate AND ToDate AND Status = 'Pending') 'Pending'
,(SELECT COUNT(*) FROM @Test WHERE @DateTime BETWEEN FromDate AND ToDate AND Status = 'Hold') 'Hold'
,(SELECT COUNT(*) FROM @Test WHERE @DateTime BETWEEN FromDate AND ToDate AND Status = 'Completed') 'Completed'
Output
Pending |
Hold |
Completed |
1 |
0 |
2 |