title: C# insert datetime to DBF file
body: <p>I'm getting a Syntax Error in the below code. From my testing, it's coming from the field <code>"tax_month"</code> which is a <code>DateTime</code>. I can't figure out how to insert a value in DateTime format.</p>
  
  <p>Schema of that field:</p>
  
  <pre><code>ColumnName:       tax_month,
  ColumnOrdinal:    0,
  ColumnSize:       6,
  NumericPrecision: 10,
  NumericScale:     0,
  DataType:         System.DateTime,
  ProviderType:     23
  </code></pre>
  
  <p>This is my C# code:</p>
  
  <pre><code>string path = @"C:\Purchases\DATA\";
  string fileName = "purchase.dbf";
  DateTime tax_month = DateTime.FromOADate(41305);
  private void button1_Click(object sender, EventArgs e)
  {
      OdbcConnection dbfConn = new OdbcConnection();
      dbfConn.ConnectionString = @"Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;Exclusive=No;Collate=Machine;NULL=NO;DELETED=YES;BACKGROUNDFETCH=NO;SourceDB=" + path;
      dbfConn.Open();
      OdbcCommand oCmd = dbfConn.CreateCommand(); // needed to query data
      oCmd.CommandText = "INSERT INTO " + fileName + " ('tax_month') VALUES ("+tax_month+")";
      int inserted = oCmd.ExecuteNonQuery();
      dbfConn.Close();
      MessageBox.Show("Number of Rows inserted:"+inserted);
  }
  </code></pre>