title: Storing DateTime variable into local C# variable
body: <p>I believe my question may seem amateurish, but my objective is to take a <code>DateTime</code> data from my database and store it into a local variable. My code snippet has been added below:</p>
  
  <pre><code>string checkdu1 = "select Top 1 Date from CF";
  SqlCommand cmdd = new SqlCommand(checkdu1, con);
  SqlDataReader dru1 = cmdd.ExecuteReader();
  DateTime d1 = Convert.ToDateTime("Date");          //error here
  </code></pre>
  
  <p>The database name is CF and the value of <code>Date</code> column is to be retrieved. But I am getting an </p>
  
  <blockquote>
    <p>exception of type 'System.FormatException' occurred in mscorlib.dll but was not handled in user code</p>
    
    <p>Additional information: The string was not recognized as a valid DateTime. There is an unknown word starting at index 0.</p>
  </blockquote>
  
  <p>The datatype of <code>Date</code> in the database is <code>DateTime</code>.</p>
  
  <p>I cannot find a proper answer and your help would be appreciated.</p>