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

saving recordset to XML file

On this page...
http://www.w3schools.com/ado/met_rs_save.asp
....it describes how to save a recordset to file with the following...

You can save a Recordset in XML format:

<%
set xmlDoc=CreateObject("Microsoft.XMLDOM")
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/webdata/northwind.mdb"

set rs = Server.CreateObject("ADODB.recordset")
rs.Open "Customers", conn
'Save the Recordset into a DOM tree
rs.Save xmldoc, 1
%>

What I don't get is where does one stipulate a filename? I put the above
code in my page and it appeared to load and execute without error. But no
file.

thanks
Sep 4 '07 #1
4 4548
shank wrote:
= = = = = = = = == = = = = = = = == = = = = = = = =
Below is my entire page. I do get records to the screen, but no file
is saved. I gave full permissions to this folder: C:\XMLData. Nothing
is written. What did I miss?
thanks
<%
xmldata=server.mappath("C:\XMLData\Products.xml")
?? Why use mappath with a true filesystem path?
rsProduct.Save xmldata, 1
Are you thinking that this code will write to the user's C drive? It
won't.
Are you looking at C:\XMLData\ on the server?

If that's not it, make sure you don't have On Error Resume Next masking
any errors.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Sep 4 '07 #2

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:uR**************@TK2MSFTNGP04.phx.gbl...
shank wrote:
>= = = = = = = = == = = = = = = = == = = = = = = = =
Below is my entire page. I do get records to the screen, but no file
is saved. I gave full permissions to this folder: C:\XMLData. Nothing
is written. What did I miss?
thanks
<%
xmldata=server.mappath("C:\XMLData\Products.xml ")

?? Why use mappath with a true filesystem path?
>rsProduct.Save xmldata, 1

Are you thinking that this code will write to the user's C drive? It
won't.
Are you looking at C:\XMLData\ on the server?

If that's not it, make sure you don't have On Error Resume Next masking
any errors.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
=================================================
I changed the server.mappath and I can now write a file to the server C
drive. Thanks!

To add another twist, I have a stored procedure that uses FOR XML AUTO,
ELEMENTS and it displays the data just the way I prefer when run in a query
in Management Studio. How do I get those exact results into a file using
ASP? It's not like it's many records. It's one huge record.

thanks
Sep 4 '07 #3
shank wrote:
To add another twist, I have a stored procedure that uses FOR XML
AUTO, ELEMENTS and it displays the data just the way I prefer when
run in a query in Management Studio. How do I get those exact results
into a file using ASP? It's not like it's many records. It's one huge
record.
For that, you will have to use an ADO Stream object. I don't have time
right now, l but if you google "Stream" and "FOR XML", you should be
able to find the examples I posted a while back.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Sep 4 '07 #4
Anthony Jones wrote:
>
Bob,

Would you happen to know off hand which version of ADODB is needed to
support the above code?
Sorry, OTOMH, I can only say that it's been supported for "a very long
time". :-) The code snip I posted came from a post I made in 2003, if that
helps.

Oh wait! That code snip was adapted from a SQL 2000 BOL article! So, what
version of ADO was "current" for SQL2000 ... ? Let's see ...
"These features use ADO 2.6."

So, at least since ADO 2.6 would have to be my answer for this question,
although I would be surprised if it failed with 2.5
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Sep 6 '07 #5

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

Similar topics

4
by: Dixie | last post by:
I have a spreadsheet that uses VBA code in Access to save itself as a text file. The line is as follows. xl.ActiveSheet.SaveAs CurrentProject.Path & "\Reports\" & DLookup("", "tblButtons",...
18
by: TORQUE | last post by:
Hi, Im wondering if anyone can help me with a problem. I have a form with more than 50 unbound fields. Some of the fields will be blank from time to time. This seems to be where im having...
5
by: Mark | last post by:
I have a VB 6 program that I have saved an audio file to using DAO and the appendchunk as is shown at http://support.microsoft.com/kb/103257/EN-US/. ; I have it working fine in that app (it saves...
4
by: Pedro Leite | last post by:
Good Afternoon. the code below is properly retreiving binary data from a database and saving it. but instead of saving at client machine is saving at the server machine. what is wrong with my...
1
by: harriegovin | last post by:
Hi, Here is the scenario. I have a web application written in vb.net. One of the functionalities of the application is to save the recordset in an xml format on to the client machine. The xml...
0
PEB
by: PEB | last post by:
Hi everyone! When I try to save a form in my database that is in 2000 file format it's very longer... And I don't have a time for wait it! There is only 10-12 forms. The concerned form has no...
1
by: Craig Brockhouse | last post by:
I have a Visual Basic program that is attached to a 97 access database. I have 6 buttons where users make themselves available and a caption pops up and states that "your name" has been made...
0
ADezii
by: ADezii | last post by:
Most Access Users realize that Recordsets, being virtual representations of a Query, Table, or SQL Statement, exist only in our PC's memory. They, and the data they contain, literally exist at one...
4
by: =?Utf-8?B?R1ROMTcwNzc3?= | last post by:
Hi Guys, thanks for your help yesterday, I've got one more question, then I think I'm done for now,... Is it possible to insert recordset data in a javascript, for instance I have a javascript...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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,...
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...
0
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...
0
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,...
0
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...

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.