473,569 Members | 2,788 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Export Access query as XML and read into dotnet DataSet??

Hi,

(I'm new to XML)

I can export data from Access as an XML file (with schema integrated in
the XML file). I can read it into a DotNet DataSet, but the schema is
not correct that is - I do not get the right columns.

Is there some kinda trick to convert the XML to a
DotNet-DataSet-readbable file??

Thanks!

M O J O
Nov 12 '05 #1
9 6766
Why don't you just query Access directly from .NET?
Why go through the step of exporting to XML, then trying to read it in?

what are you really trying to accomplish?

"M O J O" <mojo@_no_spam_ delete_this_new websolutions.dk > wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi,

(I'm new to XML)

I can export data from Access as an XML file (with schema integrated in
the XML file). I can read it into a DotNet DataSet, but the schema is
not correct that is - I do not get the right columns.

Is there some kinda trick to convert the XML to a
DotNet-DataSet-readbable file??

Thanks!

M O J O

Nov 12 '05 #2
You best best is to use ADO.NET to connect to Access rather than use its XML
file. In the future, this may be different, but the Access format is not the
same as the DataSet format of XML.

If you have to move from Access to DataSet, I would look at creating a XSLT
stylesheet and transforming to the DataSet XML using it. This is a much more
reuseable method of conversion. Not sure if anyone has already tackled this
monster, so I would do a search before writing it myself.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** *************** *************** *************** **********
Think Outside the Box!
*************** *************** *************** *************** **********
"M O J O" <mojo@_no_spam_ delete_this_new websolutions.dk > wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi,

(I'm new to XML)

I can export data from Access as an XML file (with schema integrated in
the XML file). I can read it into a DotNet DataSet, but the schema is
not correct that is - I do not get the right columns.

Is there some kinda trick to convert the XML to a
DotNet-DataSet-readbable file??

Thanks!

M O J O

Nov 12 '05 #3
Cor
Hi Mojo,

In addition to the other messages, when you want to use your access direct,
you can of course connect direct.

But when you want to use it as an export file I think that if you cannot
read an XML as a dataset you can always convert it using the XMLreader or
the LoadXML (the document object model).

A dataset is not that difficult to make although as it sometimes look.

Dim ds As New DataSet
Dim dt As New DataTable("Acti ve")
dt.Columns.Add( New DataColumn("Str ing", Type.GetType("S ystem.String")) )
dt.Columns.Add( New DataColumn("Ide nt", Type.GetType("S ystem.Int32")))
Dim keys(0) As DataColumn
keys(0) = dt.Columns("Ide nt")
dt.PrimaryKey = keys
ds.Tables.Add(d t)

I hope this helps?

Cor
Nov 12 '05 #4
Hi Dino,

I'm creating a program that will accept data from several sources
(Access, Excel and so on).

So I want to use common interface to accept these sources.

Therefor I need to be able to easily read the XML file from access.

M O J O

Dino Chiesa [Microsoft] wrote:
Why don't you just query Access directly from .NET?
Why go through the step of exporting to XML, then trying to read it in?

what are you really trying to accomplish?

"M O J O" <mojo@_no_spam_ delete_this_new websolutions.dk > wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi,

(I'm new to XML)

I can export data from Access as an XML file (with schema integrated in
the XML file). I can read it into a DotNet DataSet, but the schema is
not correct that is - I do not get the right columns.

Is there some kinda trick to convert the XML to a
DotNet-DataSet-readbable file??

Thanks!

M O J O



Nov 12 '05 #5
Please see my answer to Dino.

XSLT? I can hardly spell it! :o)

I just wanted it to be easy.

M O J O

Cowboy (Gregory A. Beamer) wrote:
You best best is to use ADO.NET to connect to Access rather than use its XML
file. In the future, this may be different, but the Access format is not the
same as the DataSet format of XML.

If you have to move from Access to DataSet, I would look at creating a XSLT
stylesheet and transforming to the DataSet XML using it. This is a much more
reuseable method of conversion. Not sure if anyone has already tackled this
monster, so I would do a search before writing it myself.


Nov 12 '05 #6
Thanks for Gregory, Dino and Cor's response.

Hi Mojo,

I agree with Gregory's idea to write an XSLT to transform the Xml to the
DataSet Xml. This is the simplest way if you want to use XML as the data
source, or you can connect to the Access file directly.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #7
Hi Mojo,

You can load xml directly into DataSet...
If the XSD schema is provided the DataSet would contain the schema.
If not it infers the schema from the Xml file...
and the columnNames will be the same as the element/attribute names in the
Xml file.

IF a Access Query is exported to Xml file, the structure is :
<dataroot>
<Products>
<ProductID>1</ProductID>
<ProductName>na me1</ProductName>
</Products>
<Products>
</Products>
</dataroot>

Therefore DataSet will interpret as two tables, dataroot and Products.
But still you will be getting the elementNames as the columnNames.

C# Code:
========
DataSet ds = new DataSet();
ds.ReadXmlSchem a(@"c:\products .xsd");
ds.ReadXml(@"C: \Products.xml") ;

Note: Access 2000 creates the XSD schema with old Schema Namespace, you
will have to change it to:
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"

When you load the schema with old namespace, DataSet throws an Exception.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #8
Access and Excel can both be queried via ADO.NET - using connection strings,
if I am not mistaken. this will get you a dataset, without having to first
"export to XML".

What's the "and so on"?

ADO.NET can do CSV, SQL server, other databases... ?

"M O J O" <mojo@_no_spam_ delete_this_new websolutions.dk > wrote in message
news:OI******** ******@TK2MSFTN GP11.phx.gbl...
Hi Dino,

I'm creating a program that will accept data from several sources
(Access, Excel and so on).

So I want to use common interface to accept these sources.

Therefor I need to be able to easily read the XML file from access.

M O J O

Dino Chiesa [Microsoft] wrote:
Why don't you just query Access directly from .NET?
Why go through the step of exporting to XML, then trying to read it in?

what are you really trying to accomplish?

"M O J O" <mojo@_no_spam_ delete_this_new websolutions.dk > wrote in message news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi,

(I'm new to XML)

I can export data from Access as an XML file (with schema integrated in
the XML file). I can read it into a DotNet DataSet, but the schema is
not correct that is - I do not get the right columns.

Is there some kinda trick to convert the XML to a
DotNet-DataSet-readbable file??

Thanks!

M O J O


Nov 12 '05 #9
On Thu, 11 Dec 2003 20:05:06 +0100, M O J O <mojo@_no_spam_ delete_this_new websolutions.dk > wrote:

¤ Hi Dino,
¤
¤ I'm creating a program that will accept data from several sources
¤ (Access, Excel and so on).
¤
¤ So I want to use common interface to accept these sources.
¤
¤ Therefor I need to be able to easily read the XML file from access.
¤
¤ M O J O
¤
¤ Dino Chiesa [Microsoft] wrote:
¤ > Why don't you just query Access directly from .NET?
¤ > Why go through the step of exporting to XML, then trying to read it in?
¤ >
¤ > what are you really trying to accomplish?
¤ >
¤ > "M O J O" <mojo@_no_spam_ delete_this_new websolutions.dk > wrote in message
¤ > news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
¤ >
¤ >>Hi,
¤ >>
¤ >>(I'm new to XML)
¤ >>
¤ >>I can export data from Access as an XML file (with schema integrated in
¤ >>the XML file). I can read it into a DotNet DataSet, but the schema is
¤ >>not correct that is - I do not get the right columns.
¤ >>
¤ >>Is there some kinda trick to convert the XML to a
¤ >>DotNet-DataSet-readbable file??
¤ >>

I don't see the need for ADO here. Access, Excel, dBase, etc can all be queried directly from
ADO.NET (with the ODBC and OLEDB namespaces) using the same ODBC and OLEDB connections that are used
under ADO.
Paul ~~~ pc******@amerit ech.net
Microsoft MVP (Visual Basic)
Nov 12 '05 #10

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

Similar topics

49
3155
by: Relaxin | last post by:
It is just me or has MS created some of the worst ways to access and display data? You can use a DataSet, but if you want to sort or filter the data to must use a DataView which is created from a DataSet. But, if you sort by using the Grid (clicking the header) you can no longer use the DataSet (or maybe the DataView, if that is what you...
1
6569
by: Charlie | last post by:
Hello, I have data in an Access table that I would like to export to multiple HTML tables. I would like to split the data in the Access table (about 92,000 records) into multiple HTML tables/files to reduce download time and bandwidth usage on my web server. That way, the user can select a particular page to download instead of...
4
33450
by: Hans [DiaGraphIT] | last post by:
Hi! I want to export a dataset to an excel file. I found following code on the net... ( http://www.codeproject.com/csharp/Export.asp ) Excel.ApplicationClass excel = new ApplicationClass(); excel.Application.Workbooks.Add(true); DataTable table = DATASETNAME.Tables;
8
1289
by: M O J O | last post by:
Hi, (I'm new to XML) I can export data from Access as an XML file (with schema integrated in the XML file). I can read it into a DotNet DataSet, but the schema is not correct that is - I do not get the right columns. Is there some kinda trick to convert the XML to a DotNet-DataSet-readbable file??
3
4617
by: BobAchgill | last post by:
I am trying to read in a xml file that I exported from my MSAccess table using the following lines of code but it bombs. Is this the right code? Is there a way to get a clean export from Access so the XML file will read in OK into a VB .Net Form dataset? =============================== Private Sub Form1_Load(ByVal sender As...
9
3441
by: dennist685 | last post by:
I created a web project named 'Access' in C:\Inetpub\wwwroot\Access and dropped an .mdb there. I dragged a DetailView to the form, configured it to show two fields of a table, and got AccessDataSource1. The test query worked. The .mdb was not open in Access, nor was it being used anywhere else. Yet when I pressed Cntl+F5 I got the...
12
5108
by: Selva Chinnasamy | last post by:
Hi I am using batch commands against Ms-Access and getting an error Message "Characters found after end of SQL statement." String Here is my sql Dim str_screens As String = "Select * from Screens Order by ScreenName;Select * from Functions" How can I fix this problem. Any help is greatly appreciated. Selva
1
9762
by: smaczylo | last post by:
Hello, I've recently been asked to work with Microsoft Access, and while I feel quite comfortable with Excel, I'm at a complete loss with databases. If someone could help me with this issue I'm having I'd be most appreciative. The database is already constructed, I'm just wanting to export the data to an excel file. In short, I'm hoping...
1
2487
by: rhbourne | last post by:
Hello, I'm doing something wrong here, and it's driving me nuts. A very strange thing is happening with a query that populates an XML export function. 1. I have a query and its XML export routine sitting in a file. That file, in turn, is called by a "New Spry dataset" block in a file that my form points to. 2. When I set up the...
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8120
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7672
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7968
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6283
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.