OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:ible.mdb"); string query_sql = "select VolumeName,ChapterNumber,SectionNumber,ChineseContent from BibleTable"; try { conn.Open(); OleDbCommand cmd = new OleDbCommand(); cmd.CommandText = query_sql; cmd.Connection = conn; OleDbDataAdapter da = new OleDbDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); cmd.ExecuteNonQuery(); if (dt.Rows.Count > 0) { System.IO.StringWriter sw = new System.IO.StringWriter(); System.Xml.XmlTextWriter xw = new System.Xml.XmlTextWriter(sw); dt.TableName = "Bible"; dt.WriteXml(xw); File.WriteAllText("bible.xml", sw.ToString(), Encoding.Default); } } catch (Exception a) { throw a; } finally { conn.Close(); }