473,386 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

DataSet loses tablenames

7
I have a created a dataset with several tables. When i do a dataset.dataSet.WriteXml tablenames get lost. For example:

<?xml version="1.0" standalone="yes"?>
<Root>
<person />
<person />
<person />
<company />
<company />

should be:

<?xml version="1.0" standalone="yes"?>
<Root>
<persons>
<person />
<person />
<person />
</persons>
<companys>
<company />
<company />
</companys>

Can anybody tell me what goes wrong?
Feb 6 '07 #1
2 1474
Ganon11
3,652 Expert 2GB
Are you writing this in C++? Should this be moved to the XML forum?

If you are writing something in C++, post the relevant code and we can try to 'debug' it.
Feb 6 '07 #2
wervis
7
I am writing this in C#. The C# DataSet has different tables. But the undelying XML has no table names.

Here is the code:

Expand|Select|Wrap|Line Numbers
  1. DataSet dataSet = new DataSet();
  2.  
  3. OdbcConnection odbcConnection = new OdbcConnection();
  4. odbcConnection.ConnectionString = ConfigurationManager.ConnectionStrings["database"].ConnectionString;
  5. OdbcCommand odbcCommand = new OdbcCommand();
  6.  
  7. try
  8. {
  9. odbcConnection.Open();
  10.  
  11.                 foreach (WorkSheet worksheet in worksheets)
  12.                 {
  13.                     odbcCommand.CommandText = worksheet.Query;
  14.                     odbcCommand.Connection = odbcConnection;
  15.                     OdbcDataAdapter odbcDataAdapter = new OdbcDataAdapter(odbcCommand);
  16.                     odbcDataAdapter.Fill(dataSet, worksheet.WorkSheetName);
  17.                 }
  18.             }
  19.             catch (Exception exception)
  20.             {
  21.                 LoggingService.HandleWervisException(LogComponent.DuchenneHeroesBeheer, LogEvent.BeheerCreateParticipantWorkSheet, exception, false);
  22.             }
  23.             finally
  24.             {
  25.                 odbcConnection.Close();
  26.             }
  27.  
  28. string folder = Server.MapPath(@"Download");
  29. dataSet.WriteXml(folder + @"\export.xml");
Feb 6 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Andreas Palm | last post by:
I have a dataset that has DBNull in certain columns, now when I write out this one to XML, I only get the columns as elements that do have data in it. However I do need also the empty colums as...
1
by: Darrylw99 | last post by:
Hi Folks I've been dumped in at the deepend and need to understand the answer pretty quickly. I've got a dropdownlist and need to use Microsoft Data Access Blocks; so implementing a Dataset, how...
2
by: Lucas Tam | last post by:
I'm not sure if this is a problem with Microsoft's Application Data Blocks, but I am using a query like this: USE DATABASENAME;SELECT * FROM SOMETABLE The tablename property of my datasets are...
3
by: Pieter | last post by:
Hi, I'm making an Outlook (2003) Add-In (VB.NET 2005), with a simple button and a textbox (msoControlEdit). When the user types something in the textbox, and clicks on the button, the text in...
4
by: Khurram | last post by:
Hi, I understand in order to extract data from the tables in a Dataset and setting it to control, the following csharp syntax applies. textBox1.Text = northwindDataSet.Customers.ContactName; ...
0
by: anonieko | last post by:
This approach I found very efficient and FAST when compared to the rowcount, or Subquery Approaches. This is before the advent of a ranking function from DB such as ROW_NUMBER() in SQL Server...
2
by: Henrik | last post by:
Hi, I'm really stuck with this one. I have a dataset with two tables. One table is company data, and the other is contacts. I populate these by using a SP in SQL Server which returns the two...
0
by: Junaid Arif | last post by:
Hi I am new to Vb.Net from VB6. I am facing a problem with update data. I have a project that will run in multy user envoirnment. I am facing multiple updates at same time that loses the...
5
by: codefragment | last post by:
Hi I have a dataset which holds (amongest other things) a string. - The dataset gets loaded from the database via a middle tier - The string value contains "\r\n" - Its serialised to the web...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.