title: error cannot convert from 'object' to 'string'
body: <p>I get some errors in my code below could any one help?</p>
  
  <blockquote>
    <p>error cannot convert from 'object' to 'string'   The best overloaded method match for 'System.IO.File.Exists(string)' has some invalid arguments</p>
  </blockquote>
  
  <pre><code>string theUserId = Session["UserID"].ToString();
  OdbcConnection cn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Database=gymwebsite2; User=x; Password=x;");
  cn.Open();
  
  OdbcCommand sc = new OdbcCommand(string.Format("SELECT picturepath FROM Pictures WHERE UserID ='{0}'", theUserId), cn);
  OdbcDataReader reader = sc.ExecuteReader();
  while (reader.Read())
  {
  if (System.IO.File.Exists(reader[0]))
  {  // error cannot convert from 'object' to 'string'
     // The best overloaded method match for 'System.IO.File.Exists(string)' has some invalid arguments
      System.IO.File.Delete(reader[0]);
  }  // error cannot convert from 'object' to 'string'
     // The best overloaded method match for 'System.IO.File.Delete(string)' has some invalid arguments
  }
  </code></pre>
  
  <p>How can this be fixed?    </p>