We can't give you an absolute answer from that code: it misses out far, far too much. For example, your query itself is assembled using a method "bagdata.Bagdata" which you don't show, and since the query string is probably going to be fairly fundamental to why you don't get the data you want, you need to look at that.
So the first thing to do is to use the debugger to breakpoint the line:
con.Open();
And examine the actual content of the Bagquery string - any WHERE clause will be significant.
However, give that you have
datefrom
and
Dateto
variables in your code, I suspect that your query is something along the lines of:
SELECT ... FROM ... WHERE dateColumn BETWEEN @dtfrom AND @dtto
And that it is probably significant that you convert dates to strings before passing them through. If you are also storing dates as strings in your DB, that is very likely to be the cause of the problem - string comparisons do not work well with date related data. Check your DB and see what datatype the columns are declared as.