using writexml in vb .net and numeric columns in excel

B

Bernie Yaeger

I use the following writexml method to convert a dataset/datatable to .xml:

ds.WriteXml(mstrpath, XmlWriteMode.WriteSchema)
ds.WriteXmlSchema(mstrpathxsd)

The path strings are simple full paths: eg, f:\emapps\xmlfiles\filename.xml
(or .xsd as appropriate).

I get an xml file, but there are 2 problems:

1. text that looks like numbers - eg, a column with 45622, 00987, 01234,
etc - drops the prefix '0' and is formatted inside excel as numeric columns.
This is so inside excel and in the .xml file itself.

2. all numeric columns - whether they should be numerics or not - have an
extra 'agg' column, which I do not want.

An ideas how I can a) convert the data to xml as text when it is a text
column and b) avoid this 'agg' column?

Tx for any help.

Bernie Yaeger
 
G

Gerry O'Brien [MVP]

Create your DataSet as a strongly typed DataSet. That way, your schema will
include the data types associated with each field. That should maintain
your data types accordingly.
 
B

Bernie Yaeger

Hi Gerry,

I was thinking - 'gee, could it be something about the dataset?' Tx for
your answer - I'm sure it will solve at least one of the issues - thanks
very much.

Bernie
 
B

Bernie Yaeger

Hi Cor,

No; I haven't seen that. I will take a look at it now. Thanks.

Bernie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top