title: Converting ODBC query results into XML
body: <p>I'm trying to write a little C# console application that would run a query on an existing ODBC connection and converting the ResultSet into an XML file.  Could some please shed some light on this?</p>
  
  <p>I was thinking to use the System.Xml.XmlReader to perform this task in the following context,</p>
  
  <pre><code>System.Data.Odbc.OdbcConnection conn = new System.Data.Odbc.OdbcConnection();
  conn.ConnectionString = "FIL=MS Access;DSN=valid data source name";
  string query = "SELECT * FROM Customers FOR XML AUTO, ELEMENTS";
  
      try {
           OdbcCommand odbcComm = new OdbcCommand(query);
           conn.Open();
           odbcComm.Connection = conn;
  
           OdbcDataReader data = odbcComm.ExecuteReader();
                           .
                           .
                           .
  
      } catch (Exception ex) {
              System.Console.WriteLine( "Failed to connect to the data source" );
      } finally {
              conn.Close();
      }
  </code></pre>
  
  <p>What do you think?</p>