Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8135321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:23:13+00:00 2026-06-06T10:23:13+00:00

I am trying to retrieve data into an xml tag from the database using

  • 0

I am trying to retrieve data into an xml tag from the database using a stored procedure. I want to create the reponse like standard xml responses. But instead I am getting a tag named: <NewDataSet/>

This is my code for retrieving data:

comm = new SqlCommand("[sp_get_business_locations]", conn);
    comm.CommandType = System.Data.CommandType.StoredProcedure;
    comm.Parameters.AddWithValue("@Latitude", Latitude);
    comm.Parameters.AddWithValue("@Longitude", Longitude);
comm.ExecuteNonQuery();    
cdoc.LoadXml(shop.GetXml());

What can be done? Thanks.

DataSet shop = new DataSet();
XmlDocument cdoc = new XmlDocument();

This is my stored procedure:

SElECT  @TotalRows=COUNT(*) FROM HeritageList   
 INNER JOIN  Reviews loc  WITH (NOLOCK) ON HeritageList.HeritageId = loc.HeritageId    
 WHERE ([dbo].[DistanceBetween] (@Latitude,@Longitude,Latitude,Longitude)) * @meters <= @Radius      
        
    IF(@TotalRows>0)    
    BEGIN    
         DECLARE @Partialxml XML      
     DECLARE @Totalxml XML      
     declare @Appendxml VARCHAR(100)       
     SET @Appendxml = '<HeritageList></HeritageList>';      
     set @Totalxml=@Appendxml      
         
     SET @Partialxml = (SELECT  HeritageList.HeritageId,
           
        
         
        Latitude as "Location/Latitude",      
        Longitude as "Location/Longitude",      
        Country as "Location/Country",      
        [State] as "Location/State",      
        City as "Location/City",      
        Postcode as "Location/Postcode",      
        [Address] as "Location/Address",     
        (Cast(Round((( [dbo].[DistanceBetween]           
         (@Latitude,@Longitude,Latitude,Longitude)) * @meters),2,1) as decimal(18,2))) as Distance    
        FROM dbo.HeritageList  INNER JOIN  Reviews loc   WITH (NOLOCK) ON HeritageList.HeritageId = loc.HeritageId    
        WHERE ([dbo].[DistanceBetween] (@Latitude,@Longitude,Latitude,Longitude)) * @meters <= @Radius     
          FOR XML PATH('Business'), ELEMENTS XSINIL)      
     SET @Totalxml.modify('insert sql:variable("@Partialxml")  as last into (/HeritageList)[1] ' )      
      
     SELECT @Totalxml      
 END    
    
END 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T10:23:15+00:00Added an answer on June 6, 2026 at 10:23 am

    Construct the DataAdapter,

    SqlDataAdapter adpater=new SqlDataAdapter(comm);
    DataSet shop=new DataSet();
    adapter.Fill(shop);
    
    XmlDocument cdoc = new XmlDocument();
    cdoc.LoadXml(shop.GetXml());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Iam trying to retrieve data from mysql database into stylesheet.php but it is not
I'm trying to retrieve record data from an MS-Access database and store it into
I am using XmlReader.Create to retrieve data from an RSS xml file. Then I
trying to retrieve some data from the database and put in into my form.
I am trying to retrieve some data from a database using jQuery's $.getJSON method
I’m trying to retrieve data from an entity and populate a viewModel property like
I am trying to retrieve CLOB data from our Oracle database. the code is
I am trying to figure out how to retrieve data from a MySQL database
I'm trying to retrieve an webpage that has XML data using file_get_contents(). $get_url_report =
I'm trying to retrieve data from an SQL Server 2000 server, and place into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.