473,382 Members | 1,380 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,382 software developers and data experts.

using writexml in vb .net and numeric columns in excel

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


Nov 21 '05 #1
4 2291
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.

--
Gerry O'Brien
Visual Basic .NET MVP
"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:O5*************@TK2MSFTNGP11.phx.gbl...
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

Nov 21 '05 #2
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

"Gerry O'Brien [MVP]" <gk******@hotmail.com> wrote in message
news:ug**************@TK2MSFTNGP15.phx.gbl...
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.

--
Gerry O'Brien
Visual Basic .NET MVP
"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:O5*************@TK2MSFTNGP11.phx.gbl...
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


Nov 21 '05 #3
Bernie,

Did you ever looked at Kelly's method, I think you have than more control
over your excel sheet.

http://www.kjmsolutions.com/datasetarray.htm

I hope this helps?

Cor

"Bernie Yaeger" <be*****@cherwellinc.com>
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

Nov 21 '05 #4
Hi Cor,

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

Bernie

"Cor Ligthert" <no************@planet.nl> wrote in message
news:Oc*************@TK2MSFTNGP12.phx.gbl...
Bernie,

Did you ever looked at Kelly's method, I think you have than more control
over your excel sheet.

http://www.kjmsolutions.com/datasetarray.htm

I hope this helps?

Cor

"Bernie Yaeger" <be*****@cherwellinc.com>
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


Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bernie Yaeger | last post by:
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...
0
by: Cheezy | last post by:
Hi all: I have a simple app on both a windows app and on a pocket pc app, which is one form with two textboxes and a button. The button basically writes the textboxes to a dataset table, and...
5
by: Colleyville Alan | last post by:
I need to import a spreadsheet into an Access table. The spreadsheet has performance for mutual funds for various periods. The problem is that if there is no info for a particular period, the...
1
by: Luis Esteban Valencia | last post by:
Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source...
0
by: Allan via DotNetMonster.com | last post by:
I am trying to save the xml doc by using asp.net, and i also know how to add the record. Dim myDS As New DataSet("Job Information") If System.IO.File.Exists(Server.MapPath("Hello.xml")) Then...
8
by: John | last post by:
Hi I need to be able to call a web service method, receive the dataset that web method returns and store it in an access table. My problem is that I don't know how to "receive" a complex type...
2
by: Scott M. Lyon | last post by:
I currently am working on a VB.NET application that imports data from an Excel spreadsheet that the customer filled in. I used the following code to use ODBC to read the data from the...
3
by: Eric | last post by:
Help! I created a XML schema with a Visual Studio tools. I'm filling a dataset with a DataAdapter. Before I use the "WriteXml" method to write the data to a xml file, I want to map the XSD file I...
0
by: vbvr | last post by:
I need to export a numeric field (TAX ID) from vb.net to Excel. The value gets converted to Numeric in Excel and leading zeroes are lost. I tried to use code posted on this site. But the style...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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...

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.