Quote:
Use of unassigned local variable 'dat'
The message is clear enough. You are trying to use something, which is not assigned yet. Here is "
dat
".
So, assign some value to it. Then read.
I guess you should read the database DateTime field inside the while loop as Ryan suggested.