DateTime DT1;
SqlCommand cmd = new SqlCommand("Select DateReceivedProviderInvoice from ProviderInvoices");
now how to assing the result of the query to DateTime variable DT1?!!!!
You can use SqlCommand.ExecuteScalar Method if you want to get a single value from a column.
SqlCommand.ExecuteScalar: Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.
DT1 = Convert.ToDateTime(cmd.ExecuteScalar());