Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Implementing XML Parser in VB6 to extract dtat from sql server and output to xml file - why doesn't it work?

Posted on 2006-03-27
1
Medium Priority
?
308 Views
Last Modified: 2013-11-23
Please, I don't know if I should post this in VB, sql server or xml quetsions so I apoogise if this is in the wrong area.

I have built a small vb6 application that adds data to a sql server table.

With every addition to the database I want to also output the uploaded data in xml format for another system to analyse.

After the data has been uploaded to the table I hope to draw out the most recent addition to the table using the code below:

     'Instance of XML Parser
    Dim oCmd, sSQL, oDom

    ''' If MSXML 4.0 is not installed this will not work!
    Set oDom = CreateObject("Msxml2.DOMDocument.4.0")

    Set oCmd = CreateObject("ADODB.Command")
    oCmd.ActiveConnection = "Provider=SQLOLEDB;Data Source=(local);Initial Catalog=SCLAnodising;UID=GCroxford;Password=xxxxx"

    sSQL = "<ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql"><sql:query>" & "select * from Build_Validation for xml auto</sql:query></ROOT>"

    oCmd.CommandText = sSQL

    oCmd.Dialect = "{5D531CB2-E6Ed-11D2-B252-00C04F681B71}"

    oCmd.Properties("Output Stream") = oDom
    oCmd.Execute , , 1024

    oDom.Save "C:\Documents and Settings\GCroxford\Desktop\testdts.xml"


The application dies giving a syntax error message relating to the line:

 sSQL = "<ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql"><sql:query>" & "select * from Build_Validation for xml auto</sql:query></ROOT>"

Can anybody help?
0
Comment
Question by:ReneLMadsen
1 Comment
 
LVL 26

Accepted Solution

by:
EDDYKT earned 2000 total points
ID: 16301225
use this


sSQL = "<ROOT xmlns:sql=""urn:schemas-microsoft-com:xml-sql""><sql:query>" & "select * from Build_Validation for xml auto</sql:query></ROOT>"
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question