--How to Create Xml after querying on Table
declare @Emp xml
declare @EmployeesTable table
(Code int, UserName nvarchar(50))
insert into @EmployeesTable values(1,'Nishant')
insert into @EmployeesTable values(2,'Kavita')
set @Emp = (select * from @EmployeesTable where UserName like '%a%' for xml path('Employee'), root('Employees'), type)
--Select * from @EmployeesTable
print(cast(@Emp as nvarchar(4000)))
--NOw if u will see the varibale @emp's Value u will see the XML Like this
/*<Employees>
<Employee>
<Code>1</Code>
<UserName>Nishant</UserName>
</Employee>
<Employee>
<Code>2</Code>
<UserName>Kavita</UserName>
</Employee>
</Employees>
*/
Hi Kavita
ReplyDeleteI can write FOR XML queries but am battling to get the output from my database call returning and XML string into a XML document in ASP.Net with c#. C# converts all the apostrophies in the xml string around the attribute values by adding a baclslash to each and then it won't load as valid XML anymore.
what am I doing wrong?
Kind regards
Neville
hey kavita dis is Aditya,
ReplyDeleteMy query is
can we read an third party server database in the form of xml file (that can be any server like oracle , mysql ...) and search our result from that xml file without saving it in the our database . if yes then plzz provide me the steps or source (adityapanday007@gmail.com)
thanx in advance
Hi,
ReplyDeleteI am sathya web developer. I want to generate xml gallery dynamically using aspx coding. Xml generate format is
/*gallery title="" thumbDir="./upload/thumbs/" imageDir="./upload/" random="true"
category name="Introducing Seattle"
image
title View of Seattle /title
desc View of Seattle /desc
thumb seattle5.jpg /thumb
img seattle5.jpg /img
/image
/category
category name="Introducing Seattle"
image
title View of Seattle /title
desc View of Seattle /desc
thumb seattle5.jpg /thumb
img seattle5.jpg /img
/imag>
/category
/gallery*/..
This is my xml gallery tags. I can add many category with xml and also i can upload many photos for any of the category. I created upload part and database with this category, but i do no how to generate xml for this category. Cna u help me for this problem.......