Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3607370
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:22:02+00:00 2026-05-18T21:22:02+00:00

I have the following code in C# Visual Studio 2010. string connectionString = Provider=Microsoft.Jet.OLEDB.4.0;Data

  • 0

I have the following code in C# Visual Studio 2010.

string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Database\\db.mde";
string sql = "SELECT * FROM Customer";
OleDbConnection connection = new OleDbConnection(connectionString);
OleDbDataAdapter adapter = new OleDbDataAdapter(sql, connection);

DataSet ds = new DataSet();
connection.Open();
adapter.Fill(ds, "Test Table");
connection.Close();
dataGridView1.DataSource = ds;
dataGridView1.DataMember = "Test Table";
ds.WriteXml("C:\\Users\\Desktop\\testfile.XML");

Now it does everything I want but I need to slightly modify the format of the XML file when it exports. Can this be easily done? I gather I need to provide a schema file which is fine but I’m not sure how to implement it with the dataset.

Currently the XML looks like this.

<?xml version="1.0" standalone="yes"?>
<NewDataSet>
  <Test_x0020_Table>
    <name>Customer1</name>
    <address>25 Big St</address>
    <suburb>Sydney NSW</suburb>
    <contact>Fred Nurk</contact>
    <phone>11 1111 1111</phone>
  </Test_x0020_Table>
</NewDataSet>

… but I want it to look like this

<?xml version="1.0" standalone="yes"?>
<Customers>
    <name>Customer1</name>
    <address>25 Big St</address>
    <suburb>Sydney NSW</suburb>
    <contact>Fred Nurk</contact>
    <phone>11 1111 1111</phone>
</Customers>

Any help would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T21:22:03+00:00Added an answer on May 18, 2026 at 9:22 pm

    The first node is the name of your table.

    You can change this by setting a name on your DataSet.

    DataSet ds = new DataSet(“Customers“); //plural


    The inner node is the record.

    You can change this by specifying the name when you fill the adapter.

    adapter.Fill(ds, “Customer“); //singular


    This will give you a result like:

     
    <Customers>
      <Customer>
        <name>Customer1</name>
        <address>25 Big St</address>
        <suburb>Sydney NSW</suburb>
        <contact>Fred Nurk</contact>
        <phone>11 1111 1111</phone>
      </Customer>
    </Customers> 

    This means if you return multiple results you would end up with:

     
    <Customers>
      <Customer>
        <name>Customer1</name>
        <address>25 Big St</address>
        <suburb>Sydney NSW</suburb>
        <contact>Fred Nurk</contact>
        <phone>11 1111 1111</phone>
      </Customer>
      <Customer>
        <name>Customer1</name>
        <address>25 Big St</address>
        <suburb>Sydney NSW</suburb>
        <contact>Fred Nurk</contact>
        <phone>11 1111 1111</phone>
      </Customer>
      <Customer>
        <name>Customer1</name>
        <address>25 Big St</address>
        <suburb>Sydney NSW</suburb>
        <contact>Fred Nurk</contact>
        <phone>11 1111 1111</phone>
      </Customer>
    </Customers> 

    You can’t have a single “Customer” because when you write the XML it’s formatting it as “Table” with “Records”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Visual Studio 2010. I have a class with the following constructor: CVideoAnnotation::CVideoAnnotation(std::string
I have the following code in Visual Studio 2005. Dim OutFile As System.IO.StreamWriter Try
I have the following piece of code in Visual C++ 2005 : : class
I have the following code: String inputFile = somefile.txt; FileInputStream in = new FileInputStream(inputFile);
I have the following code: class Program { static void Main(string[] args) { Console.WriteLine(SqrtRoot(0));
I have issues to build a project using external libraries with Visual Studio 2010
i have following code #include <iostream> #include <string> using namespace std; string generate(){ for
I have a Visual Studio 2010 extension, a .vsix file. I can obtain the
I've create the following class in Visual Studio 2010: public class Bat : Form1
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.