Fraser_Admin
asked on
vb.net web ap, sql server 2005, xml file
I would like to create an xml file with vb.net web ap. Can someone lead me in the right direction. I need to read in fields from an sql server 2005 table to create this file.
Thanks
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
this is my select statement and it is showing data_agent at the first. is there a way for it to only say name??
SELECT agent_name as name, agent_number as number
FROM data_agent
FOR XML AUTO
<data_agent name="Agent1" number="BEB001" />
<data_agent name="Agent2" number="BOR001" />
<data_agent name="Agent3" number="BOW001" />
SELECT agent_name as name, agent_number as number
FROM data_agent
FOR XML AUTO
<data_agent name="Agent1" number="BEB001" />
<data_agent name="Agent2" number="BOR001" />
<data_agent name="Agent3" number="BOW001" />
ASKER
I'm trying to use explicit and this is the error I'm getting: How can you tell if a tag is open or closed?
Parent tag ID 1 is not among the open tags. FOR XML EXPLICIT requires parent tags to be opened first. Check the ordering of the result set.
Parent tag ID 1 is not among the open tags. FOR XML EXPLICIT requires parent tags to be opened first. Check the ordering of the result set.
ASKER
ok i got that working, but i'm still not quite there.
i have
<header1>
<header2>
<stuff 1=blah 2=blah/>
</header1>
</header2>
i nead
<header1>
<header2>
<stuff 1>blah</stuff1>
<stuff 2blah<stuff2/>
</header1>
</header2>
how do i get it to look like this??
i have
<header1>
<header2>
<stuff 1=blah 2=blah/>
</header1>
</header2>
i nead
<header1>
<header2>
<stuff 1>blah</stuff1>
<stuff 2blah<stuff2/>
</header1>
</header2>
how do i get it to look like this??
ASKER
ok i figured that out. use element
You don't need to create the file .Just write FOR XML AUTO, ELEMENTS after copletion of your select query.
ASKER