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

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?
ReneLMadsenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

EDDYKTCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.