Link to home
Start Free TrialLog in
Avatar of Fraser_Admin
Fraser_AdminFlag for Canada

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
Avatar of Fraser_Admin
Fraser_Admin
Flag of Canada image

ASKER

or ideally it would be even better to have it generate from sql server stored procedure, so I can automatically email to the supplier.
ASKER CERTIFIED SOLUTION
Avatar of nmcdermaid
nmcdermaid

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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" />

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.

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??
ok i figured that out.  use element
Avatar of aditya_raj
aditya_raj

You don't need to create the file .Just write    FOR XML AUTO, ELEMENTS  after copletion of your select query.