You misunderstood how variables work. In C #, variables must reference their identifier in code. C # does not support replacing strings with variables like you might find in a language such as PHP .
Assuming you defined a variable in the code and populated it with a value from the database:
… string deliveryDate = (string)command.ExecuteScalar();
You can convert it to DateTime as follows:
DateTime dateValue = Convert.ToDateTime(deliveryDate);
source share