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

query to XML string

Hi. I'm working with a web service who requests data uploaded as an xml string with xmlhttp "POST" command. I've got the data in a query that I want to send. Unfortunately it doesn't appear thier protocols are going to allow a file upload, that would be nice and easy. Is there an easy way (short of manually forming the xml with VBA code) from the data in the query? I'm working in MSAccess 07.
Jul 1 '08 #1
9 2723
nico5038
3,080 Expert 2GB
Did you check the DoCmd.Output command ?

Nic;o)
Jul 1 '08 #2
Unfortunately, (presuming you mean the DoCmd.OutputTo command as I don't have a docmd.output) that appears to only send to a file... If I wanted to go to a file I'd generally use "ExportXML." I need to go to a string. Are you recommending I export to a file and load the file into a string?
Jul 1 '08 #3
nico5038
3,080 Expert 2GB
Yes, using the FileSystemObject a simple .ReadAll will get all into a string.
The next code shows a functon importing multiple files into multiple rows:

Expand|Select|Wrap|Line Numbers
  1. Function fncImportFiles(strPath As String)
  2.  
  3. Dim rs As DAO.Recordset
  4. 'This function will import files from the passed path into table "tblFileImport" with a memo field
  5. 'Make sure the strPath has a trailing "\"
  6. If Right(strPath, 1) <> "\" Then
  7.    strPath = strPath & "\"
  8. End If
  9.     Set rs = CurrentDb.OpenRecordset("tblFileImport")
  10.     Dim fs, f, f1, fc, s, tso
  11.     Set fs = CreateObject("Scripting.FileSystemObject")
  12.     ' file directory
  13.     Set f = fs.GetFolder(strPath)
  14.     ' file collection
  15.     Set fc = f.Files
  16.     For Each f1 In fc
  17.         Set tso = fs.OpenTextFile(strPath & f1.Name, 1, False, 0)
  18.         rs.AddNew
  19.         rs!filecontent = tso.ReadAll
  20.         rs.Update
  21.     Next
  22.  
  23. End Function
  24.  
Getting the idea ?

Nc;o)
Jul 1 '08 #4
I think so. I'll play with it and see if I can figure it out. Thanks for your help. Do you mind if I let you know if I have a problem?
Jul 1 '08 #5
nico5038
3,080 Expert 2GB
No problem, we're here to help :-)

Nic;o)
Jul 1 '08 #6
ADezii
8,834 Expert 8TB
Yes, using the FileSystemObject a simple .ReadAll will get all into a string.
The next code shows a functon importing multiple files into multiple rows:

Expand|Select|Wrap|Line Numbers
  1. Function fncImportFiles(strPath As String)
  2.  
  3. Dim rs As DAO.Recordset
  4. 'This function will import files from the passed path into table "tblFileImport" with a memo field
  5. 'Make sure the strPath has a trailing "\"
  6. If Right(strPath, 1) <> "\" Then
  7.    strPath = strPath & "\"
  8. End If
  9.     Set rs = CurrentDb.OpenRecordset("tblFileImport")
  10.     Dim fs, f, f1, fc, s, tso
  11.     Set fs = CreateObject("Scripting.FileSystemObject")
  12.     ' file directory
  13.     Set f = fs.GetFolder(strPath)
  14.     ' file collection
  15.     Set fc = f.Files
  16.     For Each f1 In fc
  17.         Set tso = fs.OpenTextFile(strPath & f1.Name, 1, False, 0)
  18.         rs.AddNew
  19.         rs!filecontent = tso.ReadAll
  20.         rs.Update
  21.     Next
  22.  
  23. End Function
  24.  
Getting the idea ?

Nc;o)
Hello Nico, just a simple question to settle my curiosity. In Line #10, why you Declare all Variables as Variants as opposed to Declaring them as Explicit Data Types?
Jul 1 '08 #7
nico5038
3,080 Expert 2GB
That's how the MS sample from the helpfile does declare the variables, I was lazy :-)

Nic;o)
Jul 1 '08 #8
NeoPa
32,556 Expert Mod 16PB
:D - But what's Microsoft's excuse?
Jul 2 '08 #9
nico5038
3,080 Expert 2GB
:D - But what's Microsoft's excuse?
1) Lazyness and/or not interested in providing us with sound "typed" samples.
2) They have been pressed by the sales dept to create a helpfile in a too short timeframe.

Guess 2 is closest...

Nic;o)
Jul 2 '08 #10

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

Similar topics

8
by: Phil Powell | last post by:
if (document.location.href.indexOf('?') >= 0) document.location.href = document.location.href.substring(0, document.location.href.indexOf('?')); if (document.location.href.indexOf('#') >= 0) {...
3
by: Dr. Oz | last post by:
Hi, I am trying to read in a query string from one page and build a link to another page based on the query string. Here's the code I am using to read in the query string: <script...
4
by: Alan Lane | last post by:
Hello world: I'm including both code and examples of query output. I appologize if that makes this message longer than it should be. Anyway, I need to change the query below into a pivot table...
0
by: starace | last post by:
I have designed a form that has 5 different list boxes where the selections within each are used as criteria in building a dynamic query. Some boxes are set for multiple selections but these list...
3
by: MLH | last post by:
Am repeating question with different subject heading, perhaps stating more clearly my problem... I have an A97 query (qryVehiclesNowners2) that has a table field in it named . Depending on the...
4
by: deko | last post by:
When using OutputTo with a query, the 'File name' window in the 'Output To' dialog gets populated with the name of the query by default. This makes the exported file self-describing if the query...
1
by: Oliver Bleckmann | last post by:
Damn, what's wrong here? CGI cgi; map<string,stringcgiParam = cgi.analyseCgiParam(); cout << cgiParam << endl; cout << cgiParam << endl; /////////////////////// #include <iostream>
2
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
How can I run this query against a table in my Access database? I don't know hwo to use it in C#. In VB I would use .Recordset = "some sql statement". How do I do this in C#? //I get a vlaue...
1
by: TF | last post by:
This group came through for me last time so here we go again. My page shows paint colors, brand name, product code, etc in a gridview with the background matching the paint color. Several links on...
3
by: pbd22 | last post by:
Hi. I need some help with structuring my query strings. I have a form with a search bar and some links. Each link is a search type (such as "community"). The HREF for the link's anchor looks...
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: 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: 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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.